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.

Advertisements
  • Builtin types
  • User-defined types
  • Derived-types
Figure 1 – 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 built-in data type.

Advertisements

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
unsigned char1 byte
signed char1 byte
int2 bytes
unsigned int2 bytes
signed int2 bytes
short int2 bytes
long int4 bytes
signed long int4 bytes
unsigned long int4 bytes
float4 bytes
double8 bytes
long double10 bytes
Table 1 – C++ Data Type Classification

Note: Some of the ranges is compiler dependent.

Advertisements

Ads Blocker Detected!!!

We have detected that you are using extensions to block ads. Please support us by disabling these ads blocker.

Exit mobile version