C++ DATATYPE

  • Datatypes are used for declaring variables and functions of different types.
  • The type of a variable determines how much much space it occupies in the storage.

C++ Data Types are divided into two groups.

  • Primitive data types.
  • Non- Primitive data types.

〈Data Types〉

-Primitive data types:-These are data types that are already present in java language.

Data type                Size                                  Range

byte                  8 bits(1 bytes)              -128 to +127

short                16 bits(2bytes)              -32,768 to +32,767

int                     32 bits(4bytes)              -2^31 to +2^31  -1

long                 64 bits(8bytes)             -2^63 to 2^63  -1

float                 32bits(4bytes)              -3.4E+38  to  +3.4E+38

double             64bits(8bytes)             -1.7E+308  to  +1.7E+308

char                 16bits(2bytes)               0 to 65,535

boolean           C++ reserves 1 

                       bits but uses 1 bits.        Logical or boolean values.

-Non-Primitive data types:-These are the data types created by the user. Non-primitive data types are called reference types because they refer to objects.