Path: utzoo!attcan!utgpu!news-server.csri.toronto.edu!mailrus!hellgate.utah.edu!helios.ee.lbl.gov!ucsd!hub.ucsb.edu!castor!stoms From: stoms@castor.ncgia.ucsb.edu (David Stoms) Newsgroups: comp.sys.mac.programmer Subject: Re: Need large array on Think C. Message-ID: <5506@hub.ucsb.edu> Date: 26 May 90 16:21:52 GMT References: <265986A9.26645@paris.ics.uci.edu> Sender: news@hub.ucsb.edu Reply-To: stoms@castor.ncgia.ucsb.edu () Distribution: usa Organization: U. C. Santa Barbara, Geography Department Lines: 33 X-Local-Date: 26 May 90 09:21:52 PDT In article <265986A9.26645@paris.ics.uci.edu> jchoi@paris.ics.uci.edu (John Choi) writes: > Sorry for this trival question, but I really need to get this >done. When I declare an array ('char arr[100][300]'), the complier >gives me an 'illegal array bounds' error. Is there any way I can >increase this limit? I'm getting tired of this question so I think I'll try to give a generic answer to cover any further problems. When you want lots of variable space >32K in Think C or any compiler that limits globals to 32K, you have to use the Memory Manager (gasp!). If you want a big array, such as "char arr[100][400]" then you need to sever your dependancy from the compiler and get your hands dirty. To allocate this array: char *arr; arr = NewPtr((Size)100*400); Then to use the array you can index like this: x = 20; y = 32; *(arr+x+y*100) = 'H'; Thats it! If you want to use a handle the only big difference is: *(*arr+x+y*100) << note the extra * >> If you do this, be sure to lock down the handle when your r.h.s. could move memory. Josh.