home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #27 / NN_1992_27.iso / spool / comp / sys / mac / programm / 18816 < prev    next >
Encoding:
Text File  |  1992-11-23  |  996 b   |  50 lines

  1. Newsgroups: comp.sys.mac.programmer
  2. Path: sparky!uunet!mcsun!fuug!funic!convex!asunta
  3. From: asunta@convex.csc.FI (Miika Asunta)
  4. Subject: Large multidimensional arrays in C (THINK/MPW)???
  5. Message-ID: <1992Nov23.161608.11712@nic.funet.fi>
  6. Sender: usenet@nic.funet.fi
  7. Nntp-Posting-Host: convex.csc.fi
  8. Organization: Finnish Academic and Research Network Project - FUNET
  9. Date: Mon, 23 Nov 92 16:16:08 GMT
  10. Lines: 38
  11.  
  12.  
  13. Let's make a 1D array example:
  14.  
  15. typedef struct {
  16.     int a,b,c;
  17.     long d
  18. } s, *sptr, **shandle;
  19.  
  20. It works fine like this:
  21.  
  22. test()
  23. {
  24. int howmany=10;
  25. shandle SS=(shandle) NewHandle(howmany*sizeof(s));
  26.  
  27. (*SS)[0].a=1
  28. (*SS)[9].a=1
  29. }
  30.  
  31. But... how can I make it work in 2 or more dimensions?
  32.  
  33. ie.
  34.  
  35. (*SS)[0][2].a=1;
  36.  
  37. doesn't work, "Illegal operation on struct"
  38.  
  39. Unfortunately I don't have K&R so I don't know if that kind of
  40. referensing is even possible.
  41.  
  42. Has anyone succeeded with this?
  43.  
  44. Miika
  45.  
  46. --
  47. Miika Asunta
  48. asunta@convex.csc.fi            Double Bass Player
  49. tel. +358-0-494 093            Macintosh Programmer
  50.