C++ Data Types
Understanding C++ data types.
C++ Data Types
As explained in the Variables chapter, a variable in C++ must be a specified data type:
int(4 bytes) - Stores whole numbers (-2,147,483,648 to 2,147,483,647)float(4 bytes) - Stores fractional numbers. Sufficient for storing 6 to 7 decimal digitsdouble(8 bytes) - Stores fractional numbers. Sufficient for storing 15 decimal digitsbool(1 byte) - Stores true or false valueschar(1 byte) - Stores a single character/letter/number, or ASCII values
Why Data Types?
Data types specify the size and type of information the variable will store. It requires careful planning to choose the right data type for the right variable depending on the application needs.