1.

What will be the output of the following C code?
#include <stdio.h>
struct Employee
{
char *Name;
};
struct Employee fun(void)
{
struct Employee emp1;
emp1.Name = "Prayag";
return emp1;
}
void main()
{
struct Employee emp2 = fun();
emp1.Name = "Ajit";
printf("%s", emp2.Name);
}

A. Prayag
B. Ajit
C. Compilation Error
D. Garbage value
E. None of these
Answer» D. Garbage value


Discussion

No Comment Found

Related MCQs