Primitive Built-in Types: C++ offer the programmer a rich assortment of built-in as well as user defined data types. Following table lists down seven basic C++ data types: Following table lists down seven basic C++ data types:
Integer: Keyword used for integer data types is int. Integers typically
requires 4 bytes of memory space and ranges from -2147483648 to
2147483647.
Character: Character data type is used for storing characters.
Keyword used for character data type is char. Characters typically requires 1 byte of memory space and ranges from -128 to 127 or 0 to 255.
Boolean: Boolean data type is used for storing boolean or logical values. A boolean variable can store either true or false. Keyword used for boolean data type is bool.
Floating Point: Floating Point data type is used for storing single precision floating point values or decimal values. Keyword used for floating point data type is float. Float variables typically requires 4 byte of memory space.
Double Floating Point: Double Floating Point data type is used for storing double precision floating point values or decimal values.
Keyword used for double floating point data type is double. Double variables typically require 8 byte of memory space.
void: Void means without any value. void datatype represents a valueless entity. Void data type is used for that function which does not returns a value.
Wide Character: Wide character data type is also a character data type but this data type has size greater than the normal 8-bit datatype.
Represented by wchar_t. It is generally 2 or 4 bytes long.
User defined data types:
Structure: It is a collection of related data elements that belong to similar or different data type.
Class: It is a collection of data members and member functions that operates on data.
enum: An enumerated data type provides a way for attaching names to numbers. The enum keyword (form C) automatically enumerates a list of words by assigning them values 0, 1, 2, and so.on.
Derived Data Type:
Array: It is a collection of similar data type elements.
Function: It is a collection of statements written to execute a specific task.
Pointer: It is a variable that stores address of another variable of similar data type.