C++ Data Types
Definition:
Data types in programming define the type of data that a variable can hold. They specify the nature of the data and how it should be stored and manipulated. Different programming languages provide various data types to accommodate a wide range of data.
Basic Data Type
Data Type | Size | Description |
---|---|---|
boolean | 1 byte | Stores true or false values |
char | 1 byte | Stores a single character/letter/number, or ASCII values |
int | 2 or 4 bytes | Stores whole numbers, without decimals |
float | 4 bytes | Stores fractional numbers,containing one or more decimals.Sufficient for storing 6-7 decimal digits |
double | 8 bytes | Stores fractional numbers, containing one or more decimals. Sufficient for storing 15 decimal digits. |