

MCQOPTIONS
Saved Bookmarks
1. |
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; } |
A. | Garbage value |
B. | 1 |
C. | 0 |
D. | Compilation error |
E. | None of these |
Answer» B. 1 | |