Xref: utzoo comp.lang.c:40234 comp.lang.c++:14237 Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!sdd.hp.com!spool.mu.edu!munnari.oz.au!goanna!minyos.xx.rmit.oz.au!s874330 From: s874330@minyos.xx.rmit.oz.au (Martin Peter Howell) Newsgroups: comp.lang.c,comp.lang.c++ Subject: Re: decalring large arrays Message-ID: <1991Jun19.161702.27434@minyos.xx.rmit.oz.au> Date: 19 Jun 91 16:17:02 GMT References: <285B94A3.25253@maccs.dcss.mcmaster.ca> Organization: RMIT Computer Centre, Melbourne Australia. Lines: 31 tomr@maccs.dcss.mcmaster.ca (Rickey Thomas Tom) writes: >I have a simple question. I sort some data. The easiest way to do this is to >decalre a large array to sotre this data and then sort the array. However, >it apopears that in a DOS environment, I am only allowed an array up to 64 K in size. Is there a way to declare larger arrays than this for sort. Is there another way that I could store a large quantity of data for sorting. >Any comments would be appreciated. Thanks in advance. A good way to do this is to define a series of small arrays and then use a macro to index them transparently #define SIZE 30000 #define Index(i) Arrays[i/SIZE][i % SIZE] int Array1[SIZE]; int Array2[SIZE]; int Array3[SIZE]; int *Arrays[3] = { Array1, Array2, Array3 }; This simulates an array of 90000 ints that can be indexed in the (almost) normal way eg., for (i = 0; i < 90000L; ++i) Index(i) = i; In practice you would probably want to malloc() each of the small arrays and change the Index macro to do bit fiddling to speed it up. --- s874330@minyos.xx.rmit.oz.au This sentance has threee errors.