Gate2018 cs Q21

0. Consider the following C program:
#include
Struct ournode {
   Char x, y, z;
};
int main() {
   struct ournode p = {‘1’, ‘0’, ‘a’ + 2};
   struct ournode *p = &q;
   printf(“%c, %c”, *((char*) q + 1), *((char*) q + 2));
   return 0;
}
The output of this program is :

  • Option : A
  • Explanation :
    So ‘a’ + 2 will be ‘c’, so Our next node p = {‘1’, ‘0’, ‘c’} and output will be 0, c. So answer is C
Cancel reply

Your email address will not be published. Required fields are marked *


Cancel reply

Your email address will not be published. Required fields are marked *