Q21: Explain enumerated data type and typedef datatype with syntax & example.

 

A21: Enumerated data type and Typedef data type are the user define data type.

 

Enumerated Data Type: It is used to define more than one integer symbolic constants.

It allows us to create our own symbolic names a list of related constants.

Syntax: enum identifier (value1, value2, valueN);

e.g. enum marriedStatus

{

            single, married, divorced, widowed;

}

enum marriedStatus person1, person2;

 

Typedef Data Type: It is used to create a new name for an existing data type:

 

Syntax: typedef existing_type new_datatype;

e.g. typedef int integer;

Post a Comment

0 Comments
* Please Don't Spam Here. All the Comments are Reviewed by Admin.