C++ data type is an inbuilt keyword that defines the type of a variable. For example, in C++ if we want to declare an integer type data type, then we have to write _int number; _However, there are three types of Data Type in C++.

All variables use the data-type during declaration to restrict a specific type of data to be stored. Therefore, we can say that the data types are used to tell the variables a particular type of data it can store.

Whenever the variable is defined in C++, the compiler allocates some memory for that variable based on a data type with which it is declared. Every data type requires a different amount of memory.

C++ Data Type

  1. Primary(Built-in) Data Types:
  • character
  • integer
  • floating point
  • boolean
  • double floating-point
  • void
  • wide character
  1. User-Defined Data Types:
  • Structure
  • Union
  • Class
  • Enumeration
  1. Derived Data Types:
  • Array
  • Function
  • Pointer
  • Reference

See the following figure.

C++ Data Types

Now, we will learn about these three types of data types in detail.

#c++ #c++ data type

C++ Data Type Example | Data Types in C++ Tutorial
2.00 GEEK