-
What will be the output of the following C code?
#include <stdio.h>
struct point1
{
int x[2];
};
struct point2
{
int *x;
};
int main()
{
struct point1 p1 = {11, 22};
struct point2 *ptr1 = (struct q*)&p1;
ptr1->x = (struct q*)&p1.x;
printf("%d\n", ptr1->x[0]);
}
-
- Compilation Error
- Segmentation fault
- Undefined behaviour
- Runtime Error
- None of these
Correct Option: C
Undefined behaviour