C++ Tutorials

C++ Tutorials

There are four built-in data types in C++ :

  • Integer data type
  • Floating point data type
  • Void data type
  • Char data type

Integer Data Type

An integer is an integral whole number without a decimal point. These numbers are used for counting. For example 26, 272, -342 are valid integers. Normally an integer can hold numbers from -32768 to 32767.

Floating point Data Type

A floating point number has a decimal point. Even if it has an integral value, it must include a decimal point at the end. Valid floating point examples are 45.0, 34.23, -234.34.

Void Data Type

It is used for following purposes :

  • It specifies the return type of a function when the function is not returning any value.
  • It indicates an empty parameter list on a function when no arguments are passed.
  • A void pointer can be assigned a pointer value of any basic data type.

Char data type

It is used to store character value in the identifier (variable/operand).