C++ Datatypes

Go to main Page

Datatypes in C++

In this tutorial, we are going to learn about basic data types such as int, float, and char with the help of examples.

Data types are declarations for variables.

In C++ data type determines the size and data associated with variables.


int pay=30,000;


C++ Fundamental Data Types

Datatype Meaning Size in bytes
float floating-point 4
int integer 2 or 4
Char Character 1
double double floating-point 8
bool boolean 1
void empty 0

Lets discuss these datatypes one by one

1.Int datatype in C++


int age=30;

2.Float and double in C++


float price=1.25;
double volume=124.5845;

3.Char in C++


char grade='A';

4.Bool in C++


bool condition=false;

5.Void in C++

Note:We cannot declare the variables of type void