0% found this document useful (0 votes)
14 views1 page

3 Sizeof Range

The document is a C program that prints the sizes and ranges of various data types including char, short, int, long, long long, float, double, and long double. It utilizes the limits defined in <limits.h> and <float.h> to display the minimum and maximum values for both integer and floating-point types. The program outputs this information to the console for reference.

Uploaded by

ejunhong03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
14 views1 page

3 Sizeof Range

The document is a C program that prints the sizes and ranges of various data types including char, short, int, long, long long, float, double, and long double. It utilizes the limits defined in <limits.h> and <float.h> to display the minimum and maximum values for both integer and floating-point types. The program outputs this information to the console for reference.

Uploaded by

ejunhong03
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as TXT, PDF, TXT or read online on Scribd
You are on page 1/ 1

#include <stdio.

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;
}

You might also like