home *** CD-ROM | disk | FTP | other *** search
- Path: sparky!uunet!charon.amdahl.com!pacbell.com!ames!saimiri.primate.wisc.edu!zaphod.mps.ohio-state.edu!cis.ohio-state.edu!rutgers!news.columbia.edu!psinntp!psinntp!dg-rtp!sheol!throopw
- From: throopw@sheol.UUCP (Wayne Throop)
- Newsgroups: comp.lang.c
- Subject: Re: & of array - what does ANSI specify for resulting value?
- Summary: what you mean "value", kemosabe?
- Message-ID: <721626996@sheol.UUCP>
- Date: 13 Nov 92 01:08:50 GMT
- References: <1992Nov12.174305.1901@ils.nwu.edu>
- Lines: 21
-
- : From: engber@ils.nwu.edu (Mike Engber)
- : Message-ID: <1992Nov12.174305.1901@ils.nwu.edu>
- : int foo[3];
- : I know ANSI specifies the type of &foo will be an int**, how about
- : the value? Is it unspecified - or - &foo[0].
-
- Hmmmm. As Will Rogers said, "It ain't what you don't know
- that'll git ya... it's all them things you know that ain't so!".
-
- The type of &foo is NOT (I repeat NOT NOT NOT) (int**).
- It is (int (*)[10]). (In K&R, it used to be of type (int*).)
- You can tell the difference by (eg)
-
- printf( "%d %d\n", sizeof *&foo, sizeof *(int**)&foo );
-
- As to the value... well, it's probably a good bet that
- ((void*)&foo) and ((void*)&foo[0]) will compare equal. Though
- I doubt that the standard claims that it must do so (what with
- its rigidly defined areas of uncertainty and doubt, and all).
- --
- Wayne Throop ...!mcnc!dg-rtp!sheol!throopw
-