decalring large arrays
sorrow at oak.circa.ufl.edu
sorrow at oak.circa.ufl.edu
Wed Jun 19 08:19:54 AEST 1991
In article <1991Jun18.205921.20757 at ux1.cso.uiuc.edu>, gordon at osiris.cso.uiuc.edu (John Gordon) writes:
|>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.
|>
|> Don't declare it as an array. Declare it as a pointer and malloc()
|>it in the program.
Sounds fair. However, in a DOS environment, you may have to use fmalloc() or
farmalloc() depending on the memory model and compiler.
Actually, this MAY be legal (never tried it, but what the hell):
void main ( void )
{
char *TheArray=(char *)malloc(BIG_NUMBER);
char TheArrayAgain[]=TheArray; // Is this legal?
}
/*
Brian Hook -- MS-DOS Programmer for Contract
-----------------------------------------------------------------
"Seamus, that's my dog...I saw her today at the reception...sorry, sixTEEN
inches....better save the women and children first...but this one goes to 11!
..anymore of that plutonium nyborg?....there can be only ONE!....like a
finger pointing to the moon....ease the seat back...one day closer to death
*/
More information about the Comp.lang.c
mailing list