Question: For the following code with an enumerated type, enum fruit _ tag { BLUEBERRY, BANANA, PINEAPPLE, WATERMELON } ; typedef enum fruit _ tag fruit

For the following code with an enumerated type,
enum fruit_tag {
BLUEBERRY,
BANANA,
PINEAPPLE,
WATERMELON
};
typedef enum fruit_tag fruit_t;
void printFruit (fruit_t myFruit){
switch(myFruit){
case BLUEBERRY:
printf("a blueberry");
break;
case BANANA:
printf("a banana");
break;
case PINEAPPLE:
printf("a pineapple");
break;
Case WATERMELON:
printf("a watermelon");
break;
}
}
void comparefruit(fruit_t fruit1, fruit_t fruit2){
if (fruit1> fruit2){
printFruit(fruit1);
printf(" is larger than ");
printFruit(fruit2);
}
else {
printFruit(fruit1);
printf(" is smaller than ");
printFruit(fruit2);
}
}
int main(void){
fruit_t myFruit = PINEAPPLE ; fruit_t otherFruit = BLUEBERRY; compareFruit (myFruit, otherFruit); Return 0;
 For the following code with an enumerated type, enum fruit_tag {

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!