how does an enumstatement differ from a typedef


How does an enumstatement differ from a typedef statement?

Typedef statement permits user to define an identifier that would show an exiting data type. The user-defined data type identifier can be used further to declare variables. It has the following syntax

                                     Typedef   datatype identifier;

Where data type refers to exiting data type and identifier is the new name given to this data type. For example

                                     Typedef int nos;

nos here symbolizes int type and now it can be used later to declare variables like

                                   nos num1,num2,num3;

Enum statement is used to declare variables that can have one of the values enclosed within braces called as enumeration constant. After declaring this, we can declare variables to be of this 'new' type. It has the following syntax

   enum identifier {value1, value2, value3......,valuen);

 

Request for Solution File

Ask an Expert for Answer!!
Computer Engineering: how does an enumstatement differ from a typedef
Reference No:- TGS0275468

Expected delivery within 24 Hours