/* SIZEOF.C Echo's precision and storage specifications for the various data types supported by C */ #include /* for printf definition */ #include /* EXIT_SUCCESS */ #include #include /* for CHAR_MIN, CHAR_MAX, etc */ #include /* for FLT_DIG, DBL_DIG, etc */ int main () { printf("char %lu bytes %d to %d \n", sizeof(char), (int)CHAR_MIN, (int)CHAR_MAX ); printf("unsigned char %lu bytes %d to %d \n", sizeof(unsigned char), 0 , UCHAR_MAX ); printf("short %lu bytes %hi to %hi \n", sizeof(short), SHRT_MIN, SHRT_MAX ); printf("unsigned short %lu bytes %hu to %hu \n", sizeof(unsigned short), 0 , USHRT_MAX ); printf("int %lu bytes %i to %i \n", sizeof(int), INT_MIN , INT_MAX ); printf("unsigned int %lu bytes %u to %u \n", sizeof(unsigned int), 0 , UINT_MAX ); printf("long %lu bytes %li to %li \n", sizeof(long), LONG_MIN, LONG_MAX ); printf("unsigned long %lu bytes %i to %lu \n", sizeof(unsigned long), 0 , ULONG_MAX ); printf("float %lu bytes %e to %e \n", sizeof(float), FLT_MIN , FLT_MAX ); printf("double %lu bytes %e to %e \n", sizeof(double), DBL_MIN , DBL_MAX ); printf("pointer %lu bytes\n\n", sizeof( void *) ); printf("precision of float %d digits\n", FLT_DIG); printf("precision of double %d digits\n", DBL_DIG); return EXIT_SUCCESS; }