

MCQOPTIONS
Saved Bookmarks
1. |
What will be the output of the following C code?#include <stdio.h> struct calculation1 { int n[2]; }; struct calculation2 { int *n; }; int main() { struct calculation1 cal1 = {10, 20}; struct calculation2 *ptr1; ptr1->n = (struct q*)&cal1.n; printf("%d n", ptr1->n[1]); } |
A. | Segmentation fault |
B. | Garbage value |
C. | Compilation Error |
D. | 20 |
E. | None of these |
Answer» B. Garbage value | |