-
What will be the output of the following C code?
#include <stdio.h>
int main()
{
struct NN
{
char *name;
struct NN *next;
};
struct NN *ptrary[10];
struct NN n, nn;
n.name = "Rahul";
n.next = NULL;
ptrary[0] = &n;
nn.name = (char*)malloc(sizeof(char)*3);
strcpy(nn.name, n.name);
nn.next = &nn;
ptrary[1] = &nn;
printf("%s\n", ptrary[1]->next->next->name);
}
-
- Rahul
- Garbage value
- Compilation Error
- Undefined behaviour
- None of these
Correct Option: A
Rahul