User defined data types are data types defined by the user. They are
1) Enumeration
2) Structure
3) Union
4) Class
1) Enumeration
This allows us to define our own data type with predefined values. The general form is,
enum userdefined_name
{
value1,
value2,
---
---
valuen
};
The default values 0,1,2,.... n-1 can be changed by giving value in the declaration as
enum userdefined_name { value1=20, vlau2=3 .... valuen=50 };
Once the enumeration data type is defined , we can declare variables of this data types. The general form is
userdefined_name variable1, variable2, ... variablen;
The variables variable1, variable2, ... variablen cannot take values other than value1=20, vlau2=3 .... valuen=50. The userdefined-name should be the same name as used in the definition.
0 comments:
Post a Comment