home *** CD-ROM | disk | FTP | other *** search
- Newsgroups: comp.sys.mac.programmer
- Path: sparky!uunet!mcsun!fuug!funic!convex!asunta
- From: asunta@convex.csc.FI (Miika Asunta)
- Subject: Large multidimensional arrays in C (THINK/MPW)???
- Message-ID: <1992Nov23.161608.11712@nic.funet.fi>
- Sender: usenet@nic.funet.fi
- Nntp-Posting-Host: convex.csc.fi
- Organization: Finnish Academic and Research Network Project - FUNET
- Date: Mon, 23 Nov 92 16:16:08 GMT
- Lines: 38
-
-
- Let's make a 1D array example:
-
- typedef struct {
- int a,b,c;
- long d
- } s, *sptr, **shandle;
-
- It works fine like this:
-
- test()
- {
- int howmany=10;
- shandle SS=(shandle) NewHandle(howmany*sizeof(s));
-
- (*SS)[0].a=1
- (*SS)[9].a=1
- }
-
- But... how can I make it work in 2 or more dimensions?
-
- ie.
-
- (*SS)[0][2].a=1;
-
- doesn't work, "Illegal operation on struct"
-
- Unfortunately I don't have K&R so I don't know if that kind of
- referensing is even possible.
-
- Has anyone succeeded with this?
-
- Miika
-
- --
- Miika Asunta
- asunta@convex.csc.fi Double Bass Player
- tel. +358-0-494 093 Macintosh Programmer
-