external declarations of ptrs and arrays

Chris Torek chris at mimsy.umd.edu
Thu Aug 2 19:40:36 AEST 1990


In article <364 at taumet.com> steve at taumet.com (Stephen Clamage) writes:
>... The declarations "pointer-to" and "array-of" are NOT equivalent
>types.  There are some expression contexts where either type
>may be used with the same semantics.

(right)

>"char *temp[20];" means "temp is the first address of an array of 20 chars".
>"temp[n]" means "n bytes past temp".

This must be a typo: `char temp[20]', not `char *temp[20]'.  In this case
temp *is* an array of 20 chars.  It *becomes* the address of the first one,
in those expression contexts, but it *is* an array.  Think `object temp,
array; value of object temp, pointer'.  It is the `value' of an array that
becomes a pointer: the array itself remains an array, always.
-- 
In-Real-Life: Chris Torek, Univ of MD Comp Sci Dept (+1 301 454 7163)
Domain:	chris at cs.umd.edu	Path:	uunet!mimsy!chris



More information about the Comp.lang.c mailing list