-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathc_int.c
49 lines (39 loc) · 1.05 KB
/
c_int.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
43
44
45
46
47
48
49
// cc c_int.c && ./a.out
#include <stdio.h>
#include <stdlib.h>
#include <stddef.h>
#include <stdint.h>
#include <limits.h>
#define PRINT(x) printf("%12s = %20lld\n", #x, (long long int) x)
#define UPRINT(x) printf("%12s = %20llu\n", #x, (unsigned long long int) x)
#define SPRINT(x) printf("%30s = %2llu\n", #x, (unsigned long long int) x)
int main(void)
{
PRINT(INT_MAX);
PRINT(INT_MIN);
UPRINT(UINT_MAX);
PRINT(LONG_MAX);
PRINT(LONG_MIN);
UPRINT(ULONG_MAX);
PRINT(LLONG_MAX);
PRINT(LLONG_MIN);
UPRINT(ULLONG_MAX);
PRINT(PTRDIFF_MIN);
PRINT(PTRDIFF_MAX);
UPRINT(SIZE_MAX);
PRINT(INTPTR_MAX);
PRINT(INTPTR_MIN);
UPRINT(UINTPTR_MAX);
SPRINT(sizeof(int));
SPRINT(sizeof(unsigned int));
SPRINT(sizeof(long int));
SPRINT(sizeof(unsigned long int));
SPRINT(sizeof(long long int));
SPRINT(sizeof(unsigned long long int));
SPRINT(sizeof(intptr_t));
SPRINT(sizeof(ptrdiff_t));
SPRINT(sizeof(void*));
typedef void* (*fptr)(void*);
SPRINT(sizeof(fptr));
return 0;
}