User Define DataType In C++
User
Defined Data type in c++ is a type by which the data can be represented.
As
the programming languages allow the user to create their own data types according to their
needs. Hence, the data types that are defined by the user are known as
user-defined data types.
Fig: Userdatatype in c++ |
Types of User-Defined Data in C++
1.
Structure
2.
Union
3.
Class
4.
Enumeration
5.
Array
6.
Pointer
7.
Typedef
1. Structure
A structure is defined as a collection of various types of related
information under one name. The keyword used for the structure is “struct”.
2. Array
An Array is defined as a collection
of homogeneous data. It should be defined before using it for the storage of
information.
3. Union
Just like structures, the union also
contain members of different data types. Unions are declared with keyword
“union” .
4. Class
A class is an important feature of
object-oriented programming language just like C++. A class is defined as a
group of objects with the same operations and attributes. It is declared using
a keyword “class”.
5. Enumeration
Enumeration is specified by using a
keyword “enum”.
6. Pointer
A Pointer is that kind of
user-defined data type that creates variables for holding the memory address of
other variables.
7. Typedef
Using the keyword “typedef”, you can define new data type names to the existing ones.
No comments:
Post a Comment