1Type Size (bytes) Format Specifier
2int at least 2, usually 4 %d, %i
3char 1 %c
4float 4 %f
5double 8 %lf
6short int 2 usually %hd
7unsigned int at least 2, usually 4 %u
8long int at least 4, usually 8 %ld, %li
9long long int at least 8 %lld, %lli
10unsigned long int at least 4 %lu
11unsigned long long int at least 8 %llu
12signed char 1 %c
13unsigned char 1 %c
14long double at least 10, usually 12 or 16 %Lf
1 [8-bit] signed char: -127 to 127
2 [8-bit] unsigned char: 0 to 255
3 [16-bit]signed short: -32767 to 32767
4 [16-bit]unsigned short: 0 to 65535
5 [32-bit]signed long: -2147483647 to 2147483647
6 [32-bit]unsigned long: 0 to 4294967295
7 [64-bit]signed long long: -9223372036854775807 to 9223372036854775807
8 [64-bit]unsigned long long: 0 to 18446744073709551615
9
1char 1 byte -128 to 127 or 0 to 255
2unsigned char 1 byte 0 to 255
3signed char 1 byte -128 to 127
4int 2 or 4 bytes -32,768 to 32,767 or -2,147,483,648 to 2,147,483,647
5unsigned int 2 or 4 bytes 0 to 65,535 or 0 to 4,294,967,295
6short 2 bytes -32,768 to 32,767
7unsigned short 2 bytes 0 to 65,535
8long 8 bytes or (4bytes for 32 bit OS) -9223372036854775808 to 9223372036854775807
9unsigned long 8 bytes 0 to 18446744073709551615
1#include <stdio.h>
2#include <stdbool.h>
3#include <stdlib.h>
4
5#define FailedToEducate 101
6#define Success 400
7
8int main(void) {
9 /*
10 A long int is:
11 32-bit compiler:
12 MIN: -2,147,483,648
13 MAX: 2,147,483,647
14 unsigned MAX: 4,294,967,295
15 64-bit compiler:
16 MIN: -9,223,372,036,854,775,808
17 MAX: 9,223,372,036,854,775,807
18 unsigned MAX: 18,446,744,073,709,551,615
19 Therefore...a long int will either be
20 -2,147,483,648 and 2,147,483,647 for a 32-bit compiler
21 or -9,223,372,036,854,775,808 and
22 9,223,372,036,854,775,807 for a 64-bit compiler,
23 whilst a long long int will just be
24 -9,223,372,036,854,775,808 and
25 9,223,372,036,854,775,807
26
27 I hope this made sense!
28 */
29
30 bool userUnderstands=true;
31
32 if(userUnderstands) {
33 exit(Success);
34 } else {
35 exit(FailedToEducate);
36 }
37}