home *** CD-ROM | disk | FTP | other *** search
/ Liren Large Software Subsidy 7 / 07.iso / c / c072 / 1.ddi / PRG3_8.C < prev    next >
Encoding:
C/C++ Source or Header  |  1987-09-19  |  982 b   |  31 lines

  1. /*Program 3_8 - Output addresses and Size of a few variables
  2.    by Stephen R. Davis
  3.  
  4.   Just as a demonstration of the different memory models, output
  5.   a few addresses and pointer sizes.
  6. */
  7.  
  8. #include <stdio.h>
  9.  
  10. /*Main - output some sample variable sizes*/
  11. main ()
  12. {
  13.     printf ("The sizes are as follows:\n"
  14.                 "  character   - %u bytes\n"
  15.                 "  integer     - %u bytes\n"
  16.                 "  float       - %u bytes\n"
  17.                 "  double      - %u bytes\n"
  18.                 "\n"
  19.                 "  pointer     - %u bytes\n"
  20.                 "  far pointer - %u bytes\n"
  21.                 "  near pointer- %u bytes\n"
  22.                 "  proc        - %u bytes\n",
  23.                 sizeof (char),
  24.                 sizeof (int),
  25.                 sizeof (float),
  26.                 sizeof (double),
  27.                 sizeof (int *),
  28.                 sizeof (int far *),
  29.                 sizeof (int near *),
  30.                 sizeof (main));
  31. }