Let\'s say I have an array arr. When would the following not give the number of elements of the array: sizeof(arr) / sizeof(arr[0])?
arr
sizeof(arr) / sizeof(arr[0])
I can
I know is old topic but what about simple solution like while loop?
int function count(array[]) { int i = 0; while(array[i] != NULL) { i++; } return i; }
I know that is slower than sizeof() but this is another example of array count.