-
What will be the output of the following C code?
#include <stdio.h>
struct M
{
char *name;
struct M *next;
};
struct M *ptrary[10];
int main()
{
struct M m1, m2;
m1.name = "xyz";
m1.next = NULL;
ptrary[0] = &m1;
strcpy(m2.name, m1.name);
ptrary[1] = &m1;
printf("%s\n", ptrary[1]->name);
return 0;
}
-
- Compilation Error
- Garbage value
- Prayag
- Segmentation fault
- None of these
Correct Option: D
Segmentation fault