3 Sizeof Range
3 Sizeof Range
h>
#include <limits.h> //integer
#include <float.h> //floating-point
int main() {
printf("char size: %d\n", sizeof(char));
printf("short size: %d\n", sizeof(short));
printf("int size: %d\n", sizeof(int));
printf("long size: %d\n", sizeof(long));
printf("long long size: %d\n", sizeof(long long));
printf("float size: %d\n", sizeof(float));
printf("double size: %d\n", sizeof(double));
printf("long double size: %d\n\n", sizeof(long double));
//integer
printf("char range: %d ~ %d\n", CHAR_MIN, CHAR_MAX);
printf("unsigned char range: 0 ~ %d\n", UCHAR_MAX);
printf("short range: %d ~ %d\n", SHRT_MIN, SHRT_MAX);
printf("unsigned short range: 0 ~ %d\n", USHRT_MAX);
printf("int range: %d ~ %d\n", INT_MIN, INT_MAX);
printf("unsigned int range: 0 ~ %u\n", UINT_MAX); //check
printf("long long range: %lld ~ %lld\n", LLONG_MIN, LLONG_MAX); //check
printf("unsigned long long range: 0 ~ %llu\n\n\n", ULLONG_MAX); //check
//floating-point
printf("float range: %e ~ %e\n", FLT_MIN, FLT_MAX);
printf("double range: %e ~ %e\n", DBL_MIN, DBL_MAX);
return 0;
}