

C++ Data Types
In previous section you learned how to declare a variable, and we mentioned that you will need the data type in order to do that.Below is a list of basic data types supported by C++:
int
: These type of of variables holds integer value.char
: holds character value like ‘c’, ‘F’, ‘B’, ‘p’, ‘q’ etc.bool
: holds boolean value true or false.double
: double-precision floating point value.float
: Single-precision floating point value.
Several of the basic types can be modified using one or more of these type modifiers
- signed
- unsigned
- short
- long
Below table will show more information about C++ data types:
Type | Typical Bit Width | Typical Range |
---|---|---|
char | 1byte | -127 to 127 or 0 to 255 |
unsigned char | 1byte | 0 to 255 |
signed char | 1byte | -127 to 127 |
int | 4bytes | -2147483648 to 2147483647 |
unsigned int | 4bytes | 0 to 4294967295 |
signed int | 4bytes | -2147483648 to 2147483647 |
short int | 2bytes | -32768 to 32767 |
unsigned short int | 2bytes | 0 to 65,535 |
signed short int | 2bytes | -32768 to 32767 |
long int | 8bytes | -2,147,483,648 o 2,147,483,647 |
signed long int | 8bytes | same as long int |
unsigned long int | 8bytes | 0 to 4,294,967,295 |
long long int | 8bytes | -(2^63) to (2^63)-1 |
unsigned long long int | 8bytes | 0 to 18,446,744,073,709,551,615 |
float | 4bytes | /td> |
double | 8bytes | |
long double | 12bytes | |
wchar_t | 2 r 4 bytes | 1 wide character |
Conclusion
In this page (written and validated by A. Gawali) you learned about C++ Data Types . What's Next? If you are interested in completing Cpp tutorial, your next topic will be learning about: Cpp Output function.
Incorrect info or code snippet? We take very seriously the accuracy of the information provided on our website. We also make sure to test all snippets and examples provided for each section. If you find any incorrect information, please send us an email about the issue: mockstacks@gmail.com.
Share On: |
Mockstacks was launched to help beginners learn programming languages; the site is optimized with no Ads as, Ads might slow down the performance. We also don't track any personal information; we also don't collect any kind of data unless the user provided us a corrected information. Almost all examples have been tested. Tutorials, references, and examples are constantly reviewed to avoid errors, but we cannot warrant full correctness of all content. By using Mockstacks.com, you agree to have read and accepted our terms of use, cookies and privacy policy.