BCA / B.Tech 9 min read

Data Types in C++

Data Types in C++:


In any programming language, data types hold a very important place. Data types are used to determine what kind of data will be stored in a variable. In simple words, data types define the nature of a variable.

Types of Data Types in C++:
Data types can be mainly divided into three categories:
  • Primary Data Types
  • Derived Data Types
  • User-Defined Data Types

Primary Data Types:
These are the most common types and include `int` (integers), `float` (decimal numbers), `double` (double-precision floating-point), `char` (single characters), `bool` (true or false), and `void` (empty).

Derived Data Types:
These are created from fundamental data types. Examples include Array, Pointer, Reference, and Function.

User-Defined Data Types:
When primary and derived data types do not meet our needs, we can use user-defined data types. These include Structure, Union, Enum, and Class.