Gate CS-2018 Question Paper With Solutions

Q. 33 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:

(A) 0, c

(B) 0, a+2

(C) ‘0’, ‘a+2’

(D) ‘0’, ‘c’

Answer: (A)

Explanation:

Gate CS-2018 Question Paper With Solutions

Learn More:   Gate EE-2014-1 Question Paper With Solutions

LEAVE A REPLY

Please enter your comment!
Please enter your name here