In this tutorial, we will learn about basic data types such as int, float, char, etc. The data type of C++ programming will learn with the help of examples.
A data type specifies the type of data that a variable can store such as
integer, character and floating etc. For example,
int count = 3;
Here, count is a variable of type int. Meaning, the variable can only store integers of either 2 or 4 bytes.
Datatype in C++ language
The table below shows the data types in C++ language
Types
Data Types
Basic Data Type
int, char, float, double, etc
Derived Data Type
array, pointer, etc
User Defined Data Type
structure
C++ Basic Data Types
The table below shows the Basic data types, their meaning, and their sizes (in bytes):
- C++ Int
- The int keyword is used to store integers (whole numbers), without decimals, s.
- Its size is usually 4 bytes. Meaning, it can store values from -2147483648 to 2147483647.
- For example: Create a variable called count of type int and assign it the value 3
- Also Declare a variable count of type int without assigning the value, and assign the value later
int count = 3;
int count;
count = 3;
count = 3;
0 Comments
if you have any doubt in programming concept please let me know