sizeof
returns the size of the type. In the second example, func( int *a )
, a is a pointer and sizeof
will report it as such. Even if you did func( int a[100] )
, a would be a pointer. If you want the size of the array in func, you must pass it as an extra argument.