-
Notifications
You must be signed in to change notification settings - Fork 0
/
Size-LimitsOfDatatypes.c
45 lines (36 loc) · 1.32 KB
/
Size-LimitsOfDatatypes.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
//Program to find the size and limits of datatypes
#include <stdio.h>
#include<limits.h>
#include<float.h>
int main()
{
printf("sizeof(char) %u\n",sizeof(char));
printf("sizeof(int) %u\n",sizeof(int));
printf("sizeof(long int) %u\n",sizeof(long int));
printf("sizeof(float) %u\n",sizeof(float));
printf("sizeof(double) %u\n",sizeof(double));
printf("sizeof(long double) %u\n",sizeof(long double));
printf("SCHAR_MIN = %d\n",SCHAR_MIN);
printf("SCHAR_MAX = %d\n",SCHAR_MAX);
printf("UCHAR_MAX = %d\n",UCHAR_MAX);
printf("SHRT_MIN = %d\n",SHRT_MIN);
printf("SHRT_MAX = %d\n",SHRT_MAX);
printf("USHRT_MAX = %d\n",SHRT_MAX);
printf("INT_MIN = %d\n",INT_MIN);
printf("INT_MAX = %d\n",INT_MAX);
printf("UINT_MAX = %u\n",UINT_MAX);
printf("LONG_MIN = %ld\n",LONG_MIN);
printf("LONG_MAX = %ld\n",LONG_MAX);
printf("ULONG_MAX = %lu\n",ULONG_MAX);
printf("FLT_MIN = %e\n",FLT_MIN);
printf("FLT_MAX = %e\n",FLT_MAX);
printf("DBL_MIN = %e\n",DBL_MIN);
printf("DBL_MAX = %e\n",DBL_MAX);
printf("LDBL_MIN = %e\n",LDBL_MIN);
printf("LDBL_MAX = %e\n",LDBL_MAX);
//Number of Digits of precision
printf("FLT_DIG = %d\n",FLT_DIG);
printf("DBL_DIG = %d\n",DBL_DIG);
printf("LDBL_DIG = %d\n",LDBL_DIG);
return 0;
}