Data Types
When declaring a variable, you need to specify what type of data we will store in it. There are data types for easy memory handling for every situation.
int | bool | |
char | short | |
long | double |
Numerical
These types are essential for storing numerical values and manipulating numeric data. We can split them into two groups:
- Data types for whole numbers (e.g., 12);
- Data types for floating point numbers (e.g., 0.12).
Bool
The bool
data type represents two boolean values: zero interpreted as false and one is interpreted as true.
![](https://codefinity-content-media-v2.s3.eu-west-1.amazonaws.com/courses/59a3e4eb-a3a1-49a4-ba70-da98e8fee510/light_off.png)
![](https://codefinity-content-media-v2.s3.eu-west-1.amazonaws.com/courses/59a3e4eb-a3a1-49a4-ba70-da98e8fee510/light_on.png)
Char
The char
data type is used to store individual characters, which can include letters, digits, punctuation marks, and special characters.
Everything was clear?
Course Content
C++ Introduction
C++ Introduction
4. Introduction to Program Flow
5. Introduction to Functions
Data Types
When declaring a variable, you need to specify what type of data we will store in it. There are data types for easy memory handling for every situation.
int | bool | |
char | short | |
long | double |
Numerical
These types are essential for storing numerical values and manipulating numeric data. We can split them into two groups:
- Data types for whole numbers (e.g., 12);
- Data types for floating point numbers (e.g., 0.12).
Bool
The bool
data type represents two boolean values: zero interpreted as false and one is interpreted as true.
![](https://codefinity-content-media-v2.s3.eu-west-1.amazonaws.com/courses/59a3e4eb-a3a1-49a4-ba70-da98e8fee510/light_off.png)
![](https://codefinity-content-media-v2.s3.eu-west-1.amazonaws.com/courses/59a3e4eb-a3a1-49a4-ba70-da98e8fee510/light_on.png)
Char
The char
data type is used to store individual characters, which can include letters, digits, punctuation marks, and special characters.
Everything was clear?