AsegGasiaBlog

C++ Part 6

C++ Part 6

Data Types & Variable :

1. Built-in Data Types.
2. Derived Data Types.
3. User Defined Data Types.
4. Type Conversion.
5. Literals or Constants.
6. Keywords.
7. Variable declaration in C++.

Built-in Data Types.

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).


Derived Data Types.

C++ also permits four types of derived data types. As the name suggests, derived data types are basically derived from built-in data types.

There are four derived derived data types.

  • Array
  • Function
  • Pointers
  • Reference

We will study these data types in further chapters.



Popular Posts