pointers to arrays
Guy Harris
guy at auspex.UUCP
Sat Feb 25 04:28:40 AEST 1989
>>> int flimflam[20];
...
>Does this imply that pointer math and subscripting of the returned
>value is scaled by the size of the array? (i.e. would &flimflam + 1
>evaluate to the same address as flimflam + 20?)
Yes. That's how it works now; if you have
int (*flimflamp)[20];
then
flimflamp + 1
would typically point "20*sizeof (int)" bytes past where "flimflamp"
points, which is also where
(*flimflamp) + 20
points ("*flimflamp" is an array-valued expression, and, in the (d)pANS
*and*, at least, in PCC-based pre-(d)pANS C implementations and possibly
other such implementations, is converted in that context to a pointer to
the first member of that array).
More information about the Comp.lang.c
mailing list