Vidyalelo
C Programming · Q123

Structure and Union

Programming · C Programming · question 123

Q123

What will be the output of the following C code? #include struct student char *name; ; struct student s; struct student fun(void) s.name = "newton"; printf("%s ", s.name); s.name = "alan"; return s; void main() struct student m = fun(); printf("%s ", m.name); m.name = "turing"; printf("%s ", s.name);

A.
newton alan alan
Answer
B.
alan newton alan
C.
alan alan newton
D.
compile time error

Answer: Option A

Solution

Answer: Option A
No explanation is given for this question Let's Discuss on Board