K
Keith Thompson
Charlie Gordon said:An array is not a pointer!
An array *has* an address, a pointer *is* an address.
Correct, of course.
When passing an array to a function, only its address is passed, which is
indistinguishible from the value of a pointer to the first element of the
array.
Not quite. When an expression of array type is evaluated it's usually
converted to a pointer to its first element. This is quite different
from the address of the array; the two have the same value (in some
sense), but different types.
For example:
int arr[10];
arr; /* decays to an int*, equivalent to &arr[0] */
&arr; /* this is a pointer to the array, of type int(*)[10] */