home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18130 < prev    next >
Encoding:
Internet Message Format  |  1992-11-08  |  1.5 KB

  1. Path: sparky!uunet!olivea!spool.mu.edu!darwin.sura.net!udel!sbcs.sunysb.edu!sbcs!cstrockb
  2. From: cstrockb@cs.sunysb.edu (Caleb Strockbine)
  3. Newsgroups: comp.sys.mac.programmer
  4. Subject: Re: How to use large arrays in Think C?
  5. Message-ID: <CSTROCKB.92Nov7145158@csws8.cs.sunysb.edu>
  6. Date: 7 Nov 92 19:51:58 GMT
  7. References: <CSTROCKB.92Nov6235644@csws12.cs.sunysb.edu> <1992Nov7.134925.21715@kth.se>
  8. Sender: usenet@sbcs.sunysb.edu (Usenet poster)
  9. Distribution: comp
  10. Organization: SUNY at Stony Brook Computer Science Dept.
  11. Lines: 26
  12. In-Reply-To: d88-jwa@alv.nada.kth.se's message of Sat, 7 Nov 1992 13: 49:25 GMT
  13. Nntp-Posting-Host: csws8.ic.sunysb.edu
  14.  
  15. In article <1992Nov7.134925.21715@kth.se> d88-jwa@alv.nada.kth.se (Jon Wdtte) writes:
  16.    Well, I would recommend getting a decent C reference, like
  17.    "The C Programming language" by K&R. I have hacked in "C" for
  18.    like 5-10 years, and still need to look stuff up sometimes
  19.  
  20. I've got K&R, and I agree... I refer to it constantly. In fact, I
  21. carry it in my backpack constantly. Very good advice, though.
  22.  
  23.    Instead, use a typedef for one row, like:
  24.  
  25.    typeDef unsigned char arrayRow [ 256 ] ;
  26.  
  27.    and allocate several of them:
  28.  
  29.        arrayRow * foo = malloc ( sizeof ( arrayRow ) * 256 ) ;
  30.  
  31.    This will give you the indirection you want:
  32.  
  33.        foo [ 1 ] [ 2 ] = ...
  34.  
  35. This is just what I needed to hear. Thanks ever so much! Now to get
  36. back to work...
  37.  
  38. Caleb.
  39. --
  40. This message has been brought to you by the letters C and S and the number 3.
  41.