-
What will be the output of the following C code?
#include <stdio.h>
struct Worker
{
char *name;
};
struct Worker w1[2], w2[2];
void main()
{
w1[0].name = "Imaraj";
w1[1] = w1[0];
w2 = w1;
printf("%s%s", w2[0].name, w2[1].name);
}
-
- Imaraj
- Compilation Error
- Garbage value
- Nothing
- None of these
Correct Option: B
Compilation Error
main.c: In function ‘main’:
main.c:11:12: error: assignment to expression with array type
w2 = w1;