decalring large arrays

Rory Jaffe fzjaffe at castor
Fri Jun 21 10:54:26 AEST 1991


In article <285B94A3.25253 at maccs.dcss.mcmaster.ca> tomr at 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.

Since this is the c++ group, here is a C++ suggestion:
I had a problem where I had to allocate a multidimensional large array.
I went crazy figuring out how to cast the pointer until I contacted
Borland:

to allocate a 20 X 40 X 30 array:
float (* arrayname)[40][30] = new float[20][40][30] ;
to delete it
delete arrayname ; // BC++ doesn't care to be told it's an array here
to use it:
	arrayname[a][b][c]

If the array is greater than 64K, just cast the pointer to huge in the
above example.



More information about the Comp.lang.c mailing list