GATE CS 2018 — Question 36

Multiple choice 2 marks Question 36 2018

Question 36

MCQ 2 marks · −0.66 Programming and Data Structures

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:

Answers and explanations are free — they just need an account.

Where this question comes from

Source: GATE 2018 Computer Science and Information Technology, Q36 (question number approximate)