GATE CS 2017, set 2 · Question 14 · Programming and Data Structures · Multiple choice (MCQ) · 1 mark · −1/3 for a wrong answer

Consider the following function implemented in C:
void printxy(int x, int y) { int *ptr; x = 0; ptr = &x; y = *ptr; *ptr = 1; printf("%d,%d",x,y); }
The output of invoking printxy(1,1) is

  1. (A) 0,0
  2. (B) 0,1
  3. (C) 1,0
  4. (D) 1,1
Answer

Answer (C)

Answer from the official GATE CS 2017 answer key.

The step-by-step solution, where available, is part of GATE CS Pro. See what Pro includes