-
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]);
}
-
- Segmentation fault
- Garbage value
- Compilation Error
- 20
- None of these
Correct Option: A
Segmentation fault