C++ DataType

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):

 Data Type
 Meaning
 Size (in Bytes)
 int
 Integer
 2 or 4
 float
 Floating point
 4
 double
 Double Floating point
 8
 char
 Character
 1
 wchar_t
 Wide Character
 2
 bool
 Boolean
 1
 void
 Empty
 0

  1. 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
    • int count = 3;
    • Also Declare a variable count of type int without assigning the value, and assign the value later
    • int count;
      count = 3;


Post a Comment

0 Comments