How to pass an array to a function
Posted: Tue Feb 25, 2020 12:44 pm
Hi All,
I have a function like this:
However, the size that gets calculated is wrong, shows 4 instead of the correct value (which is around 100).
When I use the the same line
Could someone with more experience in c help me out?
Thanks in advance!
v
I have a function like this:
Code: Select all
void myFunction(uint16_t buf[]) {
uint16_t size = sizeof(buf)
}
However, the size that gets calculated is wrong, shows 4 instead of the correct value (which is around 100).
When I use the the same line
Code: Select all
in the application, it works fine. So I guess I don't call the function correctly.uint16_t size = sizeof(myArray)
Could someone with more experience in c help me out?
Thanks in advance!
v