-
What will be the output of the following C code?
#include <stdio.h>
struct Employee
{
char *ch;
struct Employee *point;
};
void main()
{
struct Employee e1;
struct Employee e2;
e2.point = e1;
(e2.point)->ch = "Prayag";
printf("%s", e1.ch);
}
-
- Compilation Error
- Garbage value
- Prayag
- Undefined behaviour
- None of these
Correct Option: A
Compilation Error
main.c: In function ‘main’:
main.c:11:18: error: incompatible types when assigning to type ‘struct Employee *’ from type ‘struct Employee’
e2.point = e1;