-
What will be the output of the following C code?
#include <stdio.h>
struct Employee
{
char *Name;
};
struct Employee emp1;
struct Employee function(void)
{
emp1.Name = "Ajit";
printf("%s\n", emp1.Name);
emp1.Name = "Prayag";
return emp1;
}
void main()
{
struct Employee emp2 = function();
printf("%s\n", emp2.Name);
emp2.Name = "Vivek";
printf("%s\n", emp1.Name);
}
-
- Vivek
- Garbage value
- Ajit
Prayag
Prayag - Compilation Error
- None of these
Correct Option: C
Ajit
Prayag
Prayag