C'mon, guys!
David J. Fiander
djfiander at watnot.UUCP
Sat Jun 7 04:33:17 AEST 1986
>> So an array is not a pointer but a reference to an array
>> in an expression is a pointer.
>
>That's part of it, but I strongly suspect that people have been confused by
>the fact that when you use an array name in an expression it really means a
>pointer to the first member of the array; they interpret this limited
>interchangability as meaning pointers and arrays are equivalent.
I discovered a very simple way to thing of the name of an array: think of
it a a constant. That's how the compiler treats it at least, and that is
why the expression:
{
int a[10], *ptr;
ptr = &a;
}
is invalid, you can't take the address of a macro (which the name of
the array is to the compiler.
--
UUCP : {allegra,ihnp4,decvax,utzoo,clyde}!watmath!watnot!djfiander
CSNET : djfiander%watnot at waterloo.CSNET
ARPA : djfiander%watnot%waterloo.csnet at csnet-relay.ARPA
BITNET: djfiande at watdcs
More information about the Comp.lang.c
mailing list