ชนิด | คียร์เวิร์ด | จำนวนไบต์ | ขนาด |
---|---|---|---|
Character | char | 1 | –128 to 127 |
Short integer | short | 2 | –32767 to 32767 |
Integer | int | 4 | –2,147,483,647 to 2,147,438,647 |
Long integer | long | 4 | –2,147,483,647 to 2,147,438,647 |
Long long integer | long long | 8 | –9,223,372,036,854,775,807 to 9,223,372,036,854,775,807 |
Unsigned character | unsigned char | 1 | 0 to 255 |
Unsigned short integer | unsigned short | 2 | 0 to 65535 |
Unsigned integer | unsigned int | 4 | 0 to 4,294,967,295 |
Unsigned long integer | unsigned long | 4 | 0 to 4,294,967,295 |
Unsigned long long integer | unsigned long long | 8 | 0 to 18,446,744,073,709,551,615 |
Single-precision floating-point | float | 4 | 1.2E–38 to 3.4E381 |
Double-precision floating-point | double | 8 | 2.2E–308 to 1.8E3082 |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
int main(void) | |
{ | |
printf("\n-----Integer------\n"); | |
printf("%18s %10d\n","char", sizeof(char)); | |
printf("%-18s%10d\n","short", sizeof(short)); | |
printf("%-18s%10d\n","int", sizeof(int)); | |
printf("%-18s%10d\n","long", sizeof(long)); | |
printf("%-18s%10d\n","long long",sizeof(long long)); | |
printf("%-18s%10d\n","unsigned char", sizeof(unsigned char)); | |
printf("%-18s%10d\n","unsigned short", sizeof(unsigned short)); | |
printf("%-18s%10d\n","unsigned int", sizeof(unsigned int)); | |
printf("%-18s%10d\n","unsigned long", sizeof(unsigned long)); | |
printf("%-18s%10d\n","unsigned long long",sizeof(unsigned long long)); | |
printf("\n-----Floating Point------\n"); | |
printf("%-18s%10d\n","float", sizeof(float)); | |
printf("%-18s%10d\n","double", sizeof(double)); | |
return 0; | |
} |