Question: Exercise 1 0 . 0 TASK: Declare an enumerated type ( enum ) that can hold the values of each state required to implement the
Exercise
TASK: Declare an enumerated type enum that can hold the values of each state required to implement the state machine in "statemachinetutpng
Use meaningful names for each enum value.
TIP: Use the "typedef" keyword to create a type alias for your enum.
Use the name of each state for the corresponding enum value
Enumerated types
An enumerated type or enum in allows you to declare a new type which has a finite number of defined values
The syntax for declaring a new enum type is:
enum idetifier
VALUEO,
VALUE
VALUEO
As with structs and unions, anonymous enums can be declared.
Enums are treated internally by the compiler as integers by default the first element is assigned the value then for the next etc. but you should never rely on this fact
Example enum declaration and use
typedef enum RED, GREEN, BLUE
colour;
colour mycolour RED;
int main
If colour RED
printfMy colour is red.
;
CRICOS No
Step by Step Solution
There are 3 Steps involved in it
1 Expert Approved Answer
Step: 1 Unlock
Question Has Been Solved by an Expert!
Get step-by-step solutions from verified subject matter experts
Step: 2 Unlock
Step: 3 Unlock
