-
What will be the output of the following C code?
#include <stdio.h>
struct color
{
int color_code;
char color_name[20];
};
void main()
{
color c;
c.color_name = "Yellow";
printf("Yellow");
}
-
- Yellow
- Garbage value
- Compilation Error
- Nothing
- None of these
Correct Option: C
Compilation Error
main.c: In function ‘main’:
main.c:9:9: error: unknown type name ‘color’; use ‘struct’ keyword to refer to the type
color c;
^~~~~
struct
main.c:10:10: error: request for member ‘color_name’ in something not a structure or union
c.color_name = "Yellow";