C++ Data Type Classification

The C++ programming language has a wide variety of data types. In this article, you are going to get an overview of how these data types are classified.

A data type is a computer representation of identifiers such as variables or constants. The C++ data types are divided into 3 categories.

  • Builtin types
  • User-defined types
  • Derived-types
Data Types Classification
Data Types Classification

Modifiers

The C++ language supports all the primitive data types like C language. The range of each of the basic data types can be changed using modifiers. A modifier changes the range of allowed values for a builtin data type.

The C++ modifiers are listed below.

  • signed
  • unsigned
  • short
  • long

The list of all the builtin data types with each modifier and their range is given in the following table.

Data TypeSize Range
char1 byte(2^-7)  to (2^7) – 1
unsigned char1 byte0 to (2^8)-1
signed char1 byte(2^-7)  to (2^7) – 1
int2 bytes(2^-15) to (2^15)-1
unsigned int2 bytes0 to (2^16)-1
signed int2 bytes(2^-15) to (2^15)-1
short int2 bytes(2^-15) to (2^15)-1
long int4 bytes(2^-31) to (2^31)-1
signed long int4 bytes(2^-31) to (2^31)-1
unsigned long int4 bytes0 to (2^32)-1
float4 bytes3.4E-38 to 3.4E+38
double8 bytes1.7E-308 to 1.7E+308
long double10 bytes3.4E-4932 to 3.4E+4932

Note: Some of the ranges is compiler dependent.

Please support us by disabling your adblocker or whitelist this site from your adblocker. Thanks!

turn of adblocker imag