2012-01-03 12:55:10 Extended limits.c Dance Mix
( c )
  1  #include <limits.h>
2 #include <stdio.h>
3 #include <stdlib.h>
4
5 int main( int argc, char *argv[] ) {
6 printf( " type: bytes %25s %25s %25s\n", "min value", "max value", "max unsigned" );
7 printf( " char: %5ld %25d %25d %25u\n", sizeof(char), CHAR_MIN, CHAR_MAX, UCHAR_MAX );
8 printf( " short: %5ld %25d %25d %25u\n", sizeof(short), SHRT_MIN, SHRT_MAX, USHRT_MAX );
9 printf( " int: %5ld %25d %25d %25u\n", sizeof(int), INT_MIN, INT_MAX, UINT_MAX );
10 printf( " long: %5ld %25ld %25ld %25lu\n", sizeof(long), LONG_MIN, LONG_MAX, ULONG_MAX );
11 printf( " long long: %5ld %25lld %25lld %25llu\n", sizeof(long long), LLONG_MIN, LLONG_MAX, ULLONG_MAX );
12 printf( "\n" );
13
14 printf( " char: %5ld\n", sizeof(char));
15 printf( " short: %5ld\n", sizeof(short));
16 printf( " short int: %5ld\n", sizeof(short int));
17 printf( " signed short: %5ld\n", sizeof(signed short));
18 printf( " signed short int: %5ld\n", sizeof(signed short int));
19 printf( " int: %5ld\n", sizeof(int));
20 printf( " signed int: %5ld\n", sizeof(signed int));
21 printf( " long: %5ld\n", sizeof(long));
22 printf( " long int: %5ld\n", sizeof(long int));
23 printf( " signed long: %5ld\n", sizeof(signed long));
24 printf( " signed long int: %5ld\n", sizeof(signed long int));
25 printf( " long long: %5ld\n", sizeof(long long));
26 printf( " long long int: %5ld\n", sizeof(long long int));
27 printf( " signed long long: %5ld\n", sizeof(signed long long));
28 printf( "signed long long int: %5ld\n", sizeof(signed long long int));
29 printf( "\n" );
30
31 printf( " float: %5ld\n", sizeof(float));
32 printf( " void *: %5ld\n", sizeof(void *));
33 printf( " double: %5ld\n", sizeof(double));
34 printf( "long double: %5ld\n", sizeof(long double));
35 printf( " long bit: %5d\n", LONG_BIT);
36 printf( " word bit: %5d\n", WORD_BIT);
37 printf( " size_t: %5ld\n", sizeof(SIZE_T_MAX));
38 printf( " ssize_t: %5ld\n", sizeof(SSIZE_MAX));
39
40 return EXIT_SUCCESS;
41 }
Leave a comment