home *** CD-ROM | disk | FTP | other *** search
/ Microsoft Programmer's Library 1.3 / Microsoft-Programers-Library-v1.3.iso / sampcode / c / other / memory / stack.c < prev   
Encoding:
C/C++ Source or Header  |  1988-10-26  |  488 b   |  22 lines

  1. /* STACK.C illustrates stack functions including:
  2.  *      alloca          stackavail
  3.  */
  4.  
  5. #include <malloc.h>
  6. #include <stdio.h>
  7.  
  8. main()
  9. {
  10.     char *buffer;
  11.  
  12.     printf( "Bytes available on stack: %u\n", stackavail() );
  13.  
  14.     /* Allocate memory for string. */
  15.     buffer = alloca( 120 * sizeof( char ) );
  16.     printf( "Enter a string: " );
  17.     gets( buffer );
  18.     printf( "You entered: %s\n", buffer );
  19.  
  20.     printf( "Bytest available on stack: %u\n", stackavail() );
  21. }
  22.