Consider the following C program. #include<stdio.h> struct Ournode{ char…

GATE · 2018 · CS · Computer Science & IT

Consider the following C program.

#include<stdio.h>
        struct Ournode{
         char x,y,z;
};
int main(){
         struct Ournode p = {'1', '0', 'a'+2};
         struct Ournode *q = &p;
         printf ("%c, %c", *((char*)q+1), *((char*)q+2));
         return 0;
}

The output of this program is:

  1. A.

    0, c

  2. B.

    0, a+2

  3. C.

    '0', 'a+2'

  4. D.

    '0', 'c'

Attempted by 347 students.

Sign up free to check your answer

Sign up free

Explore the full course: Gate Guidance By Sanchit Sir

Loading lesson…