What are user defined data types in c++? tccicomputercoaching.com Data type should be used in variable declaration to restrict type to store data in memory.
There are 2 types of data type: 1. Primitive data type 2. User defined data type.
1. Primitive data type means predefined type for example integer, float , character etc. These data type are standard type defined by C++ language. 2. User defined data type means this type is defined by user using keyword like enum or typedef etc. A user-defined type can be a:
class ( a data structure with its own constructor, destructor, and functions ) enumeration (a distinct type whose value is restricted to a range of integer values) structure (record) (structs and classes are nearly the same except: default permissions are public in structs) typedef (an alias for a (perhaps complex) type name) Type alias ( a name that refers to a previously defined type ) Pointer-to-type A pointer is associated with a type (of the value it points to), which is specified during declaration. A pointer can only hold an address of the declared type; it cannot hold an address of a different type.