Data Types in C++

In this section of the C++ tutorial, we will have a look at data types in the C++ programming language. Data types in C++ are keywords that are used to specify the type of data we use in our C++ programs.

Types of Data Types in C++

There are many data-types available in C++. They are classified under two categories:

  1. Built-In or Fundamental Data types
  2. Derived or User-Defined Data types

Built-in data types

  1. Built-in data types are the most basic data-types in C++.
  2. The term built-in means that they are pre-defined in C++ and can be used directly in a program.
  3. char, int, float and double are the most common built-in data types.
  4. Apart from this, we also have void and bool data types.
Floating pointfloat
Double floating pointdouble
Wide characterwchar_t

Derived data types

  1. User-defined data types are those which are first declared and defined by the user before use.
  2. They are composed of built-in data types.
  3. Examples are : array, structure, union, class, pointers, etc.

Types of user-defined data types in C++

  1. struct
  2. union
  3. enum

Leave a Comment

Your email address will not be published. Required fields are marked *