

The sizeof() function returns the number of bytes occupied by a variable or array. If you know that, then you just need to divide by the number of bytes that each element of the array occupies. int num_elements = sizeof( array ) / sizeof( array[0] ); 
sizeof(array)
always comes out to be 4, being an integer type, whereas it should come out to be 13 in the above example. its not really calculating the number of elements in the array.


int b[]
is the same as int* b
), so it cannot tell us anything about the complete type of its referrant.

