Contenido del Curso
C++ Data Types
2. Numerical Data Types
4. Other Data Types and Concepts
C++ Data Types
Numerical Data Types Summary
In the preceding chapters, we covered the numerical data types int
, float
, and double
. Additionally, we discussed type modifiers such as short
, long
. By combining these types and modifiers, we can select the most appropriate data type for our specific task.
Note
The
short
type modifier cannot be used with floating-point types such asfloat
anddouble
.
Data Type | Size (bytes) | Range | Precision |
---|---|---|---|
short | 2 | -32,768 to 32,767 | |
int | 4 | -2,147,483,648 to 2,147,483,647 | |
long | 8 | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | |
float | 4 | ±1.2e-38 to ±3.4e+38 | 7 digits |
double | 8 | ±2.2e-308 to ±1.8e+308 | 15 digits |
long double | 8 to 16* | Huge* | 15-33 digits* |
* means it depends on a system
** on Windows, long long
instead of long
¿Todo estuvo claro?
Contenido del Curso
C++ Data Types
2. Numerical Data Types
4. Other Data Types and Concepts
C++ Data Types
Numerical Data Types Summary
In the preceding chapters, we covered the numerical data types int
, float
, and double
. Additionally, we discussed type modifiers such as short
, long
. By combining these types and modifiers, we can select the most appropriate data type for our specific task.
Note
The
short
type modifier cannot be used with floating-point types such asfloat
anddouble
.
Data Type | Size (bytes) | Range | Precision |
---|---|---|---|
short | 2 | -32,768 to 32,767 | |
int | 4 | -2,147,483,648 to 2,147,483,647 | |
long | 8 | -9,223,372,036,854,775,808 to 9,223,372,036,854,775,807 | |
float | 4 | ±1.2e-38 to ±3.4e+38 | 7 digits |
double | 8 | ±2.2e-308 to ±1.8e+308 | 15 digits |
long double | 8 to 16* | Huge* | 15-33 digits* |
* means it depends on a system
** on Windows, long long
instead of long
¿Todo estuvo claro?