hey guys I have couple of questions about this program.
Code:
#include <stdio.h>
#define ROW 3
#define COLUMN 10
typedef
enum { red, blue, green} color;
void printColor(char colorArray[][COLUMN]);
void favoriteColor(char colorArray[][COLUMN], color hidden);
int main(void)
{
char colorArray[ROW][COLUMN] = { "blue", "green", "red" };
color hidden = red;
printColor(colorArray);
printf("%s", "My favorite color is ");
favoriteColor(colorArray, hidden);
return 0;
}
void printColor(char colorArray[] [COLUMN])
{
int j=0;
for(j = 0; j < ROW; j++)
puts(colorArray[j]);
}
void favoriteColor(char colorArray[][COLUMN], color hidden)
{
switch (hidden)
{
case red : puts(colorArray[red]); break;
case blue : puts(colorArray[blue]); break;
case green : puts(colorArray[green]); break;
default : puts("no match");
}
}
Q1) what is the color printed by the colorArray[0], colorArray[1] and colorArray[2] ?
Q2) what is the color printed by the colorArray[red], colorArray[blue] and colorArray[green] ?
Thanks