Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

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;
image text in transcribed

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

OpenStack Trove

Authors: Amrith Kumar, Douglas Shelley

1st Edition

1484212215, 9781484212219

More Books

Students also viewed these Databases questions