Path: utzoo!utgpu!news-server.csri.toronto.edu!cs.utexas.edu!asuvax!stjhmc!f14.n15.z1.fidonet.org!Dave.Harris From: Dave.Harris@f14.n15.z1.fidonet.org (Dave Harris) Newsgroups: comp.lang.c Subject: decalring large arrays Message-ID: <14490.2861906E@stjhmc.fidonet.org> Date: 21 Jun 91 05:11:36 GMT Sender: ufgate@stjhmc.fidonet.org (newsout1.26) Organization: FidoNet node 1:15/14 - Nibbles 'n Bits, Orem UT Lines: 32 In a message of , Rickey Thomas Tom (1:114/15) 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. Some of the Dos implementations allow for the huge modifier which will allow for larger arrays. After 128K though you are stuck with powers of 2, ie 256K and 512K (should you be that lucky) are the only other legal sizes as near as I can gather. Assuming that your array isn't just raw integers but rather a struct of size say 20 or larger, then allocate these, have an array of pointers pointing to the allocated memory spots, and sort the array containing the pointers. Assuming you don't need much more than 64K, you can hold 2 64K arrays with data, qsort each 64K block then merge/shuffle sort the 2 blocks. -- Uucp: ...{gatech,ames,rutgers}!ncar!asuvax!stjhmc!15!14!Dave.Harris Internet: Dave.Harris@f14.n15.z1.fidonet.org