arrays/pointers in C

Walter Bright bright at dataio.UUCP
Fri Jun 7 02:35:44 AEST 1985


In article <459 at rtech.UUCP> jas at rtech.UUCP (Jim Shankland) writes:
>An identifier of an array object is ALWAYS read as a pointer to the
>first element of the array, except in the declaration itself.

Not quite true. Inside of a sizeof expression, arrays are not converted
to pointers. For example,

	int a[4][5];

	b = sizeof(a[2]);

b is assigned 5*sizeof(int), not sizeof(int *). Another C feature that
can only be discerned by reading between the lines.



More information about the Comp.lang.c mailing list