home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #23 / NN_1992_23.iso / spool / vmsnet / internal / 1431 < prev    next >
Encoding:
Internet Message Format  |  1992-10-09  |  1.1 KB

  1. Path: sparky!uunet!mitech!gjc
  2. From: gjc@mitech.com (George J. Carrette)
  3. Newsgroups: vmsnet.internals
  4. Subject: Re:  C Language question
  5. Message-ID: <3067@mitech.com>
  6. Date: 9 Oct 92 14:32:00 GMT
  7. References: <718580974.504412.MILLER@TGV.COM>
  8. Organization: Mitech Corporation, Concord MA
  9. Lines: 24
  10.  
  11. In article <718580974.504412.MILLER@TGV.COM>, MILLER@TGV.COM writes:
  12. > Remember:  a[i] really means *(a+i) using the rules for pointer addition.
  13. > a[i] is a macro construct.
  14. > So a[i][j] really works out to *((char *)&*(a+i) + j), I think.
  15.  
  16. Hey, the guy who said to ask this on comp.lang.c is only 50%
  17. correct. This is FAQ item!
  18.  
  19. But anyway, not true in all cases. In other words, if you see this in a program:
  20.  
  21.    a[i][j]
  22.  
  23. you don't really know if it means reference a vector of vectors or not.
  24.  
  25. It all depends on how a was declared. If char a[][], or char **a, that
  26. is one thing.
  27.  
  28. But, it may also have been declared char a[5][10]. In which case
  29. the resulting memory operations are more like what you would expect from
  30. FORTRAN. Not two memory references but one.
  31.  
  32. The is one of the funky things about the C programming language.
  33.  
  34. -gjc
  35.