Path: utzoo!attcan!uunet!tut.cis.ohio-state.edu!zaphod.mps.ohio-state.edu!uwm.edu!bionet!ames!dftsrv!mimsy!chris From: chris@mimsy.umd.edu (Chris Torek) Newsgroups: comp.lang.c Subject: Re: external declarations of ptrs and arrays Message-ID: <25840@mimsy.umd.edu> Date: 2 Aug 90 09:40:36 GMT References: <674@dg.dg.com> <364@taumet.com> Organization: U of Maryland, Dept. of Computer Science, Coll. Pk., MD 20742 Lines: 18 In article <364@taumet.com> steve@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@cs.umd.edu Path: uunet!mimsy!chris