home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / sys / mac / programm / 18236 < prev    next >
Encoding:
Text File  |  1992-11-10  |  1.1 KB  |  37 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!ieunet!tcdcs!maths.tcd.ie!tim
  3. From: tim@maths.tcd.ie (Timothy Murphy)
  4. Subject: Re: How to use large arrays in Think C?
  5. Message-ID: <1992Nov10.182129.21561@maths.tcd.ie>
  6. Organization: Dept. of Maths, Trinity College, Dublin, Ireland.
  7. References: <CSTROCKB.92Nov6235644@csws12.cs.sunysb.edu>
  8. Distribution: comp
  9. Date: Tue, 10 Nov 1992 18:21:29 GMT
  10. Lines: 25
  11.  
  12. cstrockb@cs.sunysb.edu (Caleb Strockbine) writes:
  13.  
  14. >For clarity and consistancy with the rest of the class, it would be great
  15. >if I could use regular array notation for this picture. For instance, if
  16. >I want to just run through every pixel in the image, I'd like to say:
  17.  
  18. >short i, j;
  19.  
  20. >for (i=0;i<256;i++)
  21. >  for (j=0;j<256;j++)
  22. >    ProcessPixel(image[i][j]);
  23.  
  24. The answers to this query seemed over-complicated to me.
  25. Would it not be easier just to say
  26.  
  27. char *image[256];
  28. ...
  29. for (i = 0; i < 256; i++)
  30.   image[i] = malloc(256);
  31.  
  32. -- 
  33. Timothy Murphy  
  34. e-mail: tim@maths.tcd.ie
  35. tel: +353-1-2842366
  36. s-mail: School of Mathematics, Trinity College, Dublin 2, Ireland
  37.