There are many kinds of data types. Some of them are character, integer, string, etc. The character data type gets enclosed in single quotes. Mathematical integers represent int data type. Fractional numbers and any other values contained in double-quotes denotes a string. Thus, like C++, any programming language gives ways and abilities to manage various types of data by presenting data types.

**What are Data Types?**

Data Types – Data types are a way to identify the type of data and specifies the associated operations such as mathematical, relational, or logical operations that apply to it.

**Different types of Data Types:**

There are two C++ data types :

- Fundamental Types
- Derived Types

There are fundamental data types in C++: char, int, float, double, and void that represent the character, integer, floating-point, double floating-point, and valueless data.

Data types extracted from the fundamental types are called derived types. Derived data types include arrays, functions, pointers, references, constants, classes, structures, unions, and enumerations.

**Int**

Int data types are integers such as 40, 856, -232, 0, etc. They do not consist of any fractional parts. Integers may hold positive or negative values but, whether or not integers can have contradictory values relies on the integer’s kind in that particular program.

**Char **

### Char data types are characters such as ‘A’ or ‘$’. The most basic type is char is a one-byte character. Char can contain anything which belongs to the following: a single character/letter/number or ASCII values.

**Boolean**

### The representation of logical proportions is possible by this data type. The boolean data type is used for storing boolean or logical values that can store either *true *or *false*. The keyword used for this data type is bool.

**Float **

A number with a fractional part is known as a floating-point number. Consider an example, 6.231. It is a floating-point number. 17 is an integer, but 17.0 is a floating-point number. This number is in the usual decimal notation (fractional form). Representation of floating-point in exponent notation is also possible. For example, the decimal number 147.9101 is 1.479101E02 as an exponent notation.

**Double **

Handling floating-point numbers are achievable by float data type. But we need double data type because it holds twice as much memory as type float and stores floating-point numbers with much longer range and precision (significant numbers, after the decimal point). It stands for double-precision floating-point.

**Void **

The void type defines an empty set of values. This data type uses the return type for functions that will not return a value. No object of type void may be declared. You can notice in C++ programs that the function main() has return type as void sometimes. This data type informs the compiler that the function will not return any value.

**Conditions for Assigning Data Types**

There are some rules which will make assigning data types easy :

- Assign short, int, or long data type if you are sure a variable is an integer that has no decimal points. When you are going to use large integers (such as phone or numbers) in your program, then go for long.
- Select float or double for fractional numbers (number with decimals). Data type double is preferred when zero rounding-off errors occur.
- Use char if the variable will regularly contain ONE character of data.