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

  1.     /* SIZEOF.C--Program to tell the size of the C variable */
  2.     /*            type in bytes */
  3.  
  4.     #include <stdio.h>
  5.  
  6.     main()
  7.    {
  8.  
  9.         printf( "\nA char      is %d bytes", sizeof( char ));
  10.        printf( "\nAn int      is %d bytes", sizeof( int ));
  11.        printf( "\nA short     is %d bytes", sizeof( short ));
  12.        printf( "\nA long      is %d bytes", sizeof( long ));
  13.        printf( "\nAn unsigned char  is %d bytes", sizeof( unsigned char ));
  14.        printf( "\nAn unsigned int   is %d bytes", sizeof( unsigned int ));
  15.        printf( "\nAn unsigned short is %d bytes", sizeof( unsigned short ));
  16.        printf( "\nAn unsigned long  is %d bytes", sizeof( unsigned long ));
  17.        printf( "\nA float     is %d bytes", sizeof( float ));
  18.        printf( "\nA double    is %d bytes", sizeof( double ));
  19.  
  20.        return 0;
  21.    }
  22.