728x90
728x90
Microsoft Visual C++ recognizes the types shown in the table below.
Type Name | Bytes | Other Names | Range of Values |
---|---|---|---|
int | * | signed, signed int | System dependent |
unsigned int | * | unsigned | System dependent |
__int8 | 1 0xFF | char, signed char | –128 to 127 |
__int16 | 2 0xFF FF | short, short int, signed short int | –32,768 to 32,767 |
__int32 | 4 | signed, signed int | –2,147,483,648 to 2,147,483,647 |
__int64 | 8 0xFFFF FFFF | none | –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
bool | 1 | none | false or true |
char | 1 | signed char | –128 to 127 |
unsigned char | 1 | none | 0 to 255 |
short | 2 | short int, signed short int | –32,768 to 32,767 |
unsigned short | 2 | unsigned short int | 0 to 65,535 |
long | 4 | long int, signed long int | –2,147,483,648 to 2,147,483,647 |
long long | 8 | none (but equivalent to __int64) | –9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 |
unsigned long | 4 | unsigned long int | 0 to 4,294,967,295 |
enum | * | none | Same as int |
float | 4 | none | 3.4E +/- 38 (7 digits) |
double | 8 | none | 1.7E +/- 308 (15 digits) |
long double | same as double | none | same as double |
wchar_t | 2 | __wchar_t | 0 to 65,535 |
A variable of __wchar_t designates a wide-character or multibyte character type. By default wchar_t is a typedef for unsigned short.
Sizes of Fundamental Types
Type | Size |
---|---|
bool | 1 byte |
char, unsigned char, signed char | 1 byte |
short, unsigned short | 2 bytes |
int, unsigned int | 4 bytes |
__intn | 1, 2, 4, or 8 bytes depending on the value of n. __intn is Microsoft-specific. |
long, unsigned long | 4 bytes |
float | 4 bytes |
double | 8 bytes |
long double1 | 8 bytes |
long long | Equivalent to __int64. |
1 The representation of long double and double is identical. However, long double and double are separate types.
Fundamental Types of the C++ Language
Category | Type | Contents |
---|---|---|
Integral | char | Type char is an integral type that usually contains members of the execution character set — in Microsoft C++, this is ASCII. |
The C++ compiler treats variables of type char, signed char, andunsigned char as having different types. Variables of type char are promoted to int as if they are type signed char by default, unless the /J compilation option is used. In this case they are treated as typeunsigned char and are promoted to int without sign extension. | ||
bool | Type bool is an integral type that can have one of the two values trueor false. Its size is unspecified. | |
short | Type short int (or simply short) is an integral type that is larger than or equal to the size of type char, and shorter than or equal to the size of type int. | |
Objects of type short can be declared as signed short or unsigned short. Signed short is a synonym for short. | ||
int | Type int is an integral type that is larger than or equal to the size of type short int, and shorter than or equal to the size of type long. | |
Objects of type int can be declared as signed int or unsigned int.Signed int is a synonym for int. | ||
__intn | Sized integer, where n is the size, in bits, of the integer variable. The value of n can be 8, 16, 32, or 64. (__intn is a Microsoft-specific keyword.) | |
long | Type long (or long int) is an integral type that is larger than or equal to the size of type int. | |
Objects of type long can be declared as signed long or unsignedlong. Signed long is a synonym for long. | ||
Floating | float | Type float is the smallest floating type. |
double | Type double is a floating type that is larger than or equal to type float, but shorter than or equal to the size of type long double.1 | |
long double1 | Type long double is a floating type that is equal to type double. | |
Wide-character | __wchar_t | A variable of __wchar_t designates a wide-character or multibyte character type. By default, wchar_t is a typedef for unsigned short; see /Zc:wchar_t for more information. Use the L prefix before a character or string constant to designate the wide-character-type constant. |
1 The representation of long double and double is identical. However, long double and double are separate types.
728x90
'WORK > Sotfware' 카테고리의 다른 글
hex->ascii / ascii->hex (0) | 2012.05.07 |
---|---|
von neumann architecture vs harvard architecture (0) | 2012.05.04 |
CBS 방송 APK - 갤럭시 탭 가능 (1) | 2012.04.25 |
캐리비안의 해적: 바다의 주인을 즐길수 있는 초대장 (2) | 2012.04.18 |
Dev C++ __cpu_features_init error (0) | 2012.04.03 |
댓글