home *** CD-ROM | disk | FTP | other *** search
/ NetNews Usenet Archive 1992 #26 / NN_1992_26.iso / spool / comp / programm / 3077 < prev    next >
Encoding:
Text File  |  1992-11-08  |  1.2 KB  |  46 lines

  1. Newsgroups: comp.programming
  2. Path: sparky!uunet!charon.amdahl.com!pacbell.com!sgiblab!zaphod.mps.ohio-state.edu!moe.ksu.ksu.edu!mimbres.cs.unm.edu!constellation!a.cs.okstate.edu!saeed
  3. From: saeed@a.cs.okstate.edu (SAEED FAISEL)
  4. Subject:  BIG arrays in TC
  5. Message-ID: <1992Nov6.214233.17682@a.cs.okstate.edu>
  6. Organization: Oklahoma State University, Computer Science, Stillwater
  7. Date: Fri, 6 Nov 92 21:42:33 GMT
  8. Lines: 36
  9.  
  10.  
  11. /*
  12.     PLEASE HELP !!!
  13.  
  14.     I am trying to allocate two arrays of 512x512 each.
  15.  
  16.     the following code compiles successfully on TC 2.0
  17.     but cannot allocate the desired memory.
  18.  
  19.     what do I need to do ?
  20. */
  21.  
  22. #include <mem.h>
  23. #include <stdio.h>
  24.  
  25. #define        Image_Size    (unsigned long) (512 * 512)
  26.  
  27. main ()
  28. {
  29.     unsigned char far    *I, *O;
  30.  
  31.     if ((I = farcalloc (Image_Size, sizeof (unsigned char))) == NULL)
  32.         printf ("memory allocation error.\n");
  33.     else
  34.         printf ("%ld bytes allocated at %Fp\n", Image_Size, I);
  35.  
  36.     if ((O = farcalloc (Image_Size, sizeof (unsigned char))) == NULL)
  37.         printf ("memory allocation error.\n");
  38.     else
  39.         printf ("%ld bytes allocated at %Fp\n", Image_Size, O);
  40. }
  41. -- 
  42.  
  43. Faisel Saeed
  44. Computer Science Department,   Oklahoma State University,   Stillwater, OK 
  45. ---------------------------------------------------------------------------
  46.