Home / MCQ Bank / Computer
Computer Structure And Union Difficulty: Medium

What will be the output of the following C code? #include <stdio.h> struct p { int x[2]; }; struct q { int *x; }; int main() { struct p p1 = {1, 2}; struct q *ptr1; ptr1->x = (struct q*)&p1.x; printf("%d\n", ptr1->x[1]); }

Select the correct option to test your answer:

More Computer Questions

In which part of the for loop termination condition is checked? for(I;II;III) {IV} If two threads access the same hashmap at the same time, what would happen? Which of the following is not allowed? Point out the odd item amongst the following What will be the output of the following C code? #include <stdio.h> int main() { int *((*x)())[2]; x(); printf("after x\n"); } int *((*x)())[2] { int **str; str = (int*)malloc(sizeof(int)* 2); return str; }