Answered step by step
Verified Expert Solution
Question
1 Approved Answer
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
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started