home *** CD-ROM | disk | FTP | other *** search
/ C Programming Starter Kit 2.0 / SamsPublishing-CProgrammingStarterKit-v2.0-Win31.iso / tyc / list8_4.c < prev    next >
C/C++ Source or Header  |  1993-10-16  |  838b  |  28 lines

  1.    /* Demonstrates the sizeof() operator */
  2.  
  3.    #include <stdio.h>
  4.  
  5.    /* Declare several 100 element arrays */
  6.  
  7.    int intarray[100];
  8.    float floatarray[100];
  9.    double doublearray[100];
  10.  
  11.   main()
  12.   {
  13.       /* Display the sizes of numeric data types */
  14.  
  15.       printf("\n\nSize of int = %d bytes", sizeof(int));
  16.       printf("\nSize of short = %d bytes", sizeof(short));
  17.       printf("\nSize of long = %d bytes", sizeof(long));
  18.       printf("\nSize of float = %d bytes", sizeof(float));
  19.       printf("\nSize of double = %d bytes", sizeof(double));
  20.  
  21.       /* Display the sizes of the three arrays */
  22.  
  23.       printf("\nSize of intarray = %d bytes", sizeof(intarray));
  24.       printf("\nSize of floatarray = %d bytes", sizeof(floatarray));
  25.       printf("\nSize of doublearray = %d bytes", sizeof(doublearray));
  26.  
  27.   }
  28.