0

How can we see the range of datatypes????

program should ans such as Range of integer is::-32768 to 32767

5th Dec 2016, 4:57 PM
Bhinwa Ram Gurjar
Bhinwa Ram Gurjar - avatar
3 Réponses
0
Use LIMITS.H header file that includes all the data type information pluse programs..also use the sizeof () operator Type ____Storage Size ____Value Range char ___1 byte : -128 to 127 or 0 to 255 unsigned char___1 byte____0 to 255 signed char___1 byte___-128 to 127 int___2 or 4 bytes___-32,768 to 32,767 or -2,147,483,648 to 2,147,483,647 unsigned int___2 or 4 bytes___0 to 65,535 or 0 to 4,1294,967,295 short___2 bytes___-32,768 to 32,767 unsigned short___2 bytes___0 to 65,535 long___4 bytes___-2,147,483,648 to 2,147,483,647 unsigned long___4 bytes___0 to 4,294,967,295
5th Dec 2016, 6:23 PM
Vipul Walia
Vipul Walia - avatar
0
dear explain it by program
5th Dec 2016, 6:24 PM
Bhinwa Ram Gurjar
Bhinwa Ram Gurjar - avatar
0
#include<stdio.h> #include<limits.h> int main() { printf("The number of bits in a byte %d\n", CHAR_BIT); printf("The minimum value of SIGNED CHAR = %d\n", SCHAR_MIN); printf("The maximum value of SIGNED CHAR = %d\n", SCHAR_MAX); printf("The maximum value of UNSIGNED CHAR = %d\n", UCHAR_MAX); printf("The minimum value of SHORT INT = %d\n", SHRT_MIN); printf("The maximum value of SHORT INT = %d\n", SHRT_MAX); printf("The minimum value of INT = %d\n", INT_MIN); printf("The maximum value of INT = %d\n", INT_MAX); printf("The minimum value of CHAR = %d\n", CHAR_MIN); printf("The maximum value of CHAR = %d\n", CHAR_MAX); printf("The minimum value of LONG = %ld\n", LONG_MIN); printf("The maximum value of LONG = %ld\n", LONG_MAX); return(0); } I hope you'll archive your results by this.
5th Dec 2016, 6:27 PM
Vipul Walia
Vipul Walia - avatar