|
1 | 1 | --- |
2 | 2 | title: "Data Type Ranges" |
3 | | -ms.date: "05/07/2019" |
| 3 | +ms.date: "05/28/2020" |
4 | 4 | helpviewer_keywords: ["float keyword [C++]", "char keyword [C++]", "unsigned long", "__wchar_t keyword [C++]", "unsigned short int [C++]", "enum keyword [C++]", "unsigned char keyword [C++]", "integer data type [C++], data type ranges", "int data type", "data types [C++], ranges", "unsigned int [C++]", "short data type", "short int data", "signed types [C++], data type ranges", "long long keyword [C++]", "long double keyword [C++]", "double data type [C++], data type ranges", "signed short int [C++]", "unsigned short", "sized integer types", "signed int [C++]", "signed long int [C++]", "signed char keyword [C++]", "wchar_t keyword [C++]", "long keyword [C++]", "ranges [C++]", "unsigned types [C++], data type ranges", "floating-point numbers [C++]", "data type ranges", "ranges [C++], data types", "long int keyword [C++]", "unsigned long int [C++]"] |
5 | 5 | ms.assetid: 3691ceca-05fb-4b82-b1ae-5c4618cda91a |
6 | 6 | --- |
@@ -30,39 +30,39 @@ The ranges that are specified in the following table are inclusive-inclusive. |
30 | 30 |
|
31 | 31 | |Type Name|Bytes|Other Names|Range of Values| |
32 | 32 | |---------------|-----------|-----------------|---------------------| |
33 | | -|**int**|4|**signed**|-2,147,483,648 to 2,147,483,647| |
34 | | -|**unsigned int**|4|**unsigned**|0 to 4,294,967,295| |
35 | | -|**__int8**|1|**char**|-128 to 127| |
36 | | -|**unsigned __int8**|1|**unsigned char**|0 to 255| |
37 | | -|**__int16**|2|**short**, **short int**, **signed short int**|-32,768 to 32,767| |
38 | | -|**unsigned __int16**|2|**unsigned short**, **unsigned short int**|0 to 65,535| |
39 | | -|**__int32**|4|**signed**, **signed int**, **int**|-2,147,483,648 to 2,147,483,647| |
40 | | -|**unsigned __int32**|4|**unsigned**, **unsigned int**|0 to 4,294,967,295| |
41 | | -|**__int64**|8|**long long**, **signed long long**|-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807| |
42 | | -|**unsigned __int64**|8|**unsigned long long**|0 to 18,446,744,073,709,551,615| |
43 | | -|**bool**|1|none|**false** or **true**| |
44 | | -|**char**|1|none|-128 to 127 by default<br /><br /> 0 to 255 when compiled by using [/J](../build/reference/j-default-char-type-is-unsigned.md)| |
45 | | -|**signed char**|1|none|-128 to 127| |
46 | | -|**unsigned char**|1|none|0 to 255| |
47 | | -|**short**|2|**short int**, **signed short int**|-32,768 to 32,767| |
48 | | -|**unsigned short**|2|**unsigned short int**|0 to 65,535| |
49 | | -|**long**|4|**long int**, **signed long int**|-2,147,483,648 to 2,147,483,647| |
50 | | -|**unsigned long**|4|**unsigned long int**|0 to 4,294,967,295| |
51 | | -|**long long**|8|none (but equivalent to **__int64**)|-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807| |
52 | | -|**unsigned long long**|8|none (but equivalent to **unsigned __int64**)|0 to 18,446,744,073,709,551,615| |
53 | | -|**enum**|varies|none| | |
54 | | -|**float**|4|none|3.4E +/- 38 (7 digits)| |
55 | | -|**double**|8|none|1.7E +/- 308 (15 digits)| |
56 | | -|**long double**|same as **double**|none|Same as **double**| |
57 | | -|**wchar_t**|2|**__wchar_t**|0 to 65,535| |
58 | | - |
59 | | -Depending on how it's used, a variable of **__wchar_t** designates either a wide-character type or multibyte-character type. Use the `L` prefix before a character or string constant to designate the wide-character-type constant. |
60 | | - |
61 | | -**signed** and **unsigned** are modifiers that you can use with any integral type except **bool**. Note that **char**, **signed char**, and **unsigned char** are three distinct types for the purposes of mechanisms like overloading and templates. |
62 | | - |
63 | | -The **int** and **unsigned int** types have a size of four bytes. However, portable code should not depend on the size of **int** because the language standard allows this to be implementation-specific. |
64 | | - |
65 | | -C/C++ in Visual Studio also supports sized integer types. For more information, see [__int8, \__int16, \__int32, \__int64](../cpp/int8-int16-int32-int64.md) and [Integer Limits](../cpp/integer-limits.md). |
| 33 | +|`int`|4|`signed`|-2,147,483,648 to 2,147,483,647| |
| 34 | +|`unsigned int`|4|`unsigned`|0 to 4,294,967,295| |
| 35 | +|`__int8`|1|`char`|-128 to 127| |
| 36 | +|`unsigned __int8`|1|`unsigned char`|0 to 255| |
| 37 | +|`__int16`|2|`short`, `short int`, `signed short int`|-32,768 to 32,767| |
| 38 | +|`unsigned __int16`|2|`unsigned short`, `unsigned short int`|0 to 65,535| |
| 39 | +|`__int32`|4|`signed`, `signed int`, `int`|-2,147,483,648 to 2,147,483,647| |
| 40 | +|`unsigned __int32`|4|`unsigned`, `unsigned int`|0 to 4,294,967,295| |
| 41 | +|`__int64`|8|`long long`, `signed long long`|-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807| |
| 42 | +|`unsigned __int64`|8|`unsigned long long`|0 to 18,446,744,073,709,551,615| |
| 43 | +|`bool`|1|none|`false` or `true`| |
| 44 | +|`char`|1|none|-128 to 127 by default<br /><br /> 0 to 255 when compiled by using [/J](../build/reference/j-default-char-type-is-unsigned.md)| |
| 45 | +|`signed char`|1|none|-128 to 127| |
| 46 | +|`unsigned char`|1|none|0 to 255| |
| 47 | +|`short`|2|`short int`, `signed short int`|-32,768 to 32,767| |
| 48 | +|`unsigned short`|2|`unsigned short int`|0 to 65,535| |
| 49 | +|`long`|4|`long int`, `signed long int`|-2,147,483,648 to 2,147,483,647| |
| 50 | +|`unsigned long`|4|`unsigned long int`|0 to 4,294,967,295| |
| 51 | +|`long long`|8|none (but equivalent to `__int64`)|-9,223,372,036,854,775,808 to 9,223,372,036,854,775,807| |
| 52 | +|`unsigned long long`|8|none (but equivalent to `unsigned __int64`)|0 to 18,446,744,073,709,551,615| |
| 53 | +|`enum`|varies|none| | |
| 54 | +|`float`|4|none|3.4E +/- 38 (7 digits)| |
| 55 | +|`double`|8|none|1.7E +/- 308 (15 digits)| |
| 56 | +|`long double`|same as `double`|none|Same as `double`| |
| 57 | +|`wchar_t`|2|`__wchar_t`|0 to 65,535| |
| 58 | + |
| 59 | +Depending on how it's used, a variable of `__wchar_t` designates either a wide-character type or multibyte-character type. Use the `L` prefix before a character or string constant to choose the wide-character-type constant. |
| 60 | + |
| 61 | +`signed` and `unsigned` are modifiers that you can use with any integral type except `bool`. Note that `char`, `signed char`, and `unsigned char` are three distinct types for the purposes of mechanisms like overloading and templates. |
| 62 | + |
| 63 | +The `int` and `unsigned int` types have a size of 4 bytes. However, portable code shouldn't depend on the size of `int` because the language standard allows this to be implementation-specific. |
| 64 | + |
| 65 | +C/C++ in Visual Studio also supports sized integer types. For more information, see [__int8, \__int16, \__int32, \__int64](../cpp/int8-int16-int32-int64.md), and [Integer Limits](../cpp/integer-limits.md). |
66 | 66 |
|
67 | 67 | For more information about the restrictions of the sizes of each type, see [Built-in types](../cpp/fundamental-types-cpp.md). |
68 | 68 |
|
|
0 commit comments