pointer problems, help!

Chris Torek torek at elf.ee.lbl.gov
Mon Mar 25 11:11:33 AEST 1991


In article <1991Mar22.193636.10853 at dg-rtp.dg.com> hagins at gamecock.rtp.dg.com
(Jody Hagins) writes:
[a bunch of stuff, mostly right, but a fine point that needs correcting]
>>   char filename[80], ...

>This means that you are setting aside enough space for 80 chars, and
>that memory has a starting address.  The starting address is stored in
>the variable <filename>.

Actually,

	char filename[80];

declares `filename' as an <object, array 80 of char>, setting aside
space for 80 `char's.  The starting address is not necessarily `stored'
anywhere, but it can be computed on demand (in an arbitrary,
machine-dependent manner, by the compiler) and in in fact computed
whenever

	<object, array 80 of char, filename>

appears where a value is required.  The Rule says that, in any value
context, an object of type `array N of T' (for any integer constant N
and legal type T) is converted to a value of type `pointer to T' whose
value is the address of the 0'th element of that array.
-- 
In-Real-Life: Chris Torek, Lawrence Berkeley Lab CSE/EE (+1 415 486 5427)
Berkeley, CA		Domain:	torek at ee.lbl.gov



More information about the Comp.lang.c mailing list