1.

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);
}

A. Rahul
B. Garbage value
C. Compilation Error
D. Undefined behaviour
E. None of these
Answer» B. Garbage value


Discussion

No Comment Found

Related MCQs