108k views
0 votes
What is the value of this expression?

(int)blue
refer to data type color_t
typedef enum
{
red, orange, yellow,green, blue
}
color_t;
A. 0
B. 1
C. 4
D. 5

User Saim
by
4.9k points

1 Answer

1 vote

Answer:

C. 4

Step-by-step explanation:

typedef enum{

red,orange,yellow,green,blue

}

color_t;

defines an enumeration type color_t with the values red,orange,yellow,green,blue.

If we print out the values of these individual elements they will be as follows:

red : 0

orange : 1

yellow: 2

green: 3

blue: 4

Note that the integer values are dependent on the position in the definition.

User Demodave
by
4.6k points