home *** CD-ROM | disk | FTP | other *** search
/ The C Users' Group Library 1994 August / wc-cdrom-cusersgrouplibrary-1994-08.iso / listings / v_03_02 / 3n02050a < prev    next >
Text File  |  1991-09-17  |  423b  |  22 lines

  1. // memory.c example 1
  2. // cl /AL /Lp memory.c
  3. // bind286 memory
  4. // memory
  5.  
  6. #include <stdlib.h>
  7. #include <stdio.h>
  8.  
  9. main()
  10. {
  11.     int i = 0;
  12.     printf("Allocating memory...\n");
  13.     while(1)
  14.        if (malloc((unsigned)65512))  
  15.           printf("Allocated 64K: %d blocks\n",++i);
  16.        else
  17.           break;
  18.     printf("Ran out of available memory\n\n");
  19.     printf("Allocated %dK total.\n",i*64);
  20. }
  21.  
  22.