home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / lang / c / 16423 < prev    next >
Encoding:
Text File  |  1992-11-12  |  1.5 KB  |  39 lines

  1. Newsgroups: comp.lang.c
  2. Path: sparky!uunet!ukma!usenet.ins.cwru.edu!agate!stanford.edu!leland.Stanford.EDU!dkeisen
  3. From: dkeisen@leland.Stanford.EDU (Dave Eisen)
  4. Subject: Re: & of array - what does ANSI specify for resulting value?
  5. Message-ID: <1992Nov12.211918.8502@leland.Stanford.EDU>
  6. Sender: news@leland.Stanford.EDU (Mr News)
  7. Organization: Sequoia Peripherals, Inc.
  8. References: <1992Nov12.174305.1901@ils.nwu.edu>
  9. Date: Thu, 12 Nov 92 21:19:18 GMT
  10. Lines: 27
  11.  
  12. In article <1992Nov12.174305.1901@ils.nwu.edu> engber@ils.nwu.edu (Mike Engber) writes:
  13. >
  14. >int foo[3];
  15. >
  16. >I know ANSI specifies the type of &foo will be an int**, how about
  17. >the value? Is it unspecified - or - &foo[0].
  18.  
  19. No, ANSI doesn't specify this. 
  20.  
  21. foo is an array of the ints (int [3]), so its address is a pointer
  22. to that type, a pointer to an int of 3 arrays (int (*)[3]), not
  23. an (int **) which is a pointer to a pointer to an int. Array names
  24. are converted to a pointer to their first element when used in an
  25. expression; they are not converted when used as the operand of sizeof
  26. or &.
  27.  
  28. I really don't understand what you mean by its value. &foo is clearly
  29. a pointer which points to foo. This is, after all, the definition of
  30. the "&" operator. But I'm sure you knew that. So what are you driving at?
  31.  
  32.  
  33.  
  34. -- 
  35. Dave Eisen                               Sequoia Peripherals: (415) 967-5644
  36. dkeisen@leland.Stanford.EDU              Home:                (415) 321-5154
  37.        There's something in my library to offend everybody. 
  38.           --- Washington Coalition Against Censorship
  39.