GATE CS 2018 · Question 12 · Programming and Data Structures · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer
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
Answer (A)
Answer from the official GATE CS 2018 answer key.
The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes