-
Notifications
You must be signed in to change notification settings - Fork 67
/
Copy pathlimits_of_c_lang.c
42 lines (38 loc) · 1.29 KB
/
limits_of_c_lang.c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
/*
Lists limits of C Programming Language Types.
NOTE: Must compile with -std=c99 in gcc.
Steven Schronk
*/
#include <stdio.h>
#include <stdlib.h>
#include <limits.h>
int main(void)
{
printf("\nThis Program Displays The Limits of Datatypes on this System.\n\n");
printf("Bits in a Single Char: %d\n", CHAR_BIT);
printf("Max Bytes in Multibyte Char (Any Locale): %d\n", MB_LEN_MAX);
printf("\n");
printf("Char Min:\t\t%+d\n", CHAR_MIN);
printf("Char Max:\t\t%+d\n", CHAR_MAX);
printf("Signed Char Min:\t%+d\n", SCHAR_MIN);
printf("Signed Char Max:\t%+d\n", SCHAR_MAX);
printf("Unsigned Char Max:\t%+d\n", UCHAR_MAX);
printf("\n");
printf("Short Min:\t\t%+d\n", SHRT_MIN);
printf("Short Max:\t\t%+d\n", SHRT_MAX);
printf("Unsigned Short Max:\t%+d\n", USHRT_MAX);
printf("\n");
printf("Integer Min:\t\t%+d\n", INT_MIN);
printf("Integer Max:\t\t%+d\n", INT_MAX);
printf("Unsigned Integer Max:\t%+d\n", UINT_MAX);
printf("\n");
printf("Long Min:\t\t%+ld\n", LONG_MIN);
printf("Long Max:\t\t%+ld\n", LONG_MAX);
printf("Unsigned Long Max:\t+%lu\n", ULONG_MAX);
printf("\n");
printf("Long Long Min:\t\t%+lld\n", LLONG_MIN);
printf("Long Long Max:\t\t%+lld\n", LLONG_MAX);
printf("Unsigned Long Long Max: +%llu\n", ULLONG_MAX);
printf("\n");
return EXIT_SUCCESS;
}