-
What will be the output of the following C code?
#include <stdio.h>
struct p
{
struct p *next;
int n;
};
int main()
{
struct p* ptr1 = malloc(sizeof(struct p));
ptr1->n = 1;
ptr1->next = malloc(sizeof(struct p));
printf("%d\n", ptr1->next->n);
return 0;
}
-
- Garbage value
- 1
- 0
- Compilation error
- None of these
Correct Option: A
Garbage value