CPP Data Types

CPP Data Types are used to define the type of data that is to be stored. CPP data types can be classified into 4 groups:

Basic Data Types:

  1. Integer
  2. Float
  3. Double
  4. Character

Derived Data Types:

  1. Array
  2. Pointer

Enumeration Data Types:

  1. Enum

User Defined Data Types:

  1. Structure


Basic Data Types:

Integer: All the non-decimal numbers are called as Integers. Various forms of integers are listed below.

Data TypesSIZE (Byte)

For 32 bit

short2−32,768 to 32,767
signed short2−32,768 to 32,767
unsigned short20 to 65,535
int2−32,768 to 32,767
signed int2−32,768 to 32,767
unsigned int20 to 65,535
short int2−32,768 to 32,767
signed short int2−32,768 to 32,767
unsigned short int20 to 65,535
long int4-2,147,483,648 to 2,147,483,647
signed long  int4-2,147,483,648 to 2,147,483,647
unsigned long int40 to 4,294,967,295


Float represents all the decimal and exponential numbers. The float size is of 4 bytes.


Double also represents all the decimal and exponential numbers. Various forms of double are listed below.

Data TypesSIZE (Byte) For 32 bit
long double10


Various forms of characters are listed below.

Data TypesSIZE (Byte)RANGE
char1−128 to 127
signed char1−128 to 127
unsigned char10 to 255



#include <iostream.h>
using namespace std; 
int main()
int num1;
float num2;
char ch;
cout << "Enter an integer: ";
cin >> num1;
cout << "Enter a decimal number: ";
cin >> num2;
cout << "Enter a letter: ";
cin >> ch;
cout << “You Entered an Integer:<< num1 << endl; 
cout << “You Entered a Decimal Value:<< num2 << endl; 
cout << “You Entered a Character:<< ch << endl; 
return 0;


Enter an integer: 5
Enter a decimal number: 4.5
Enter a letter: A
You Entered an Integer: 5
You Entered a Decimal Value: 4.5
You Entered a Character: A
Content Protection by DMCA.com
Please Share