GATE CS 2024, set 2 · Question 36 · Programming and Data Structures · Multiple choice (MCQ) · 2 marks · −2/3 for a wrong answer

What is the output of the following C program?
#include <stdio.h> int main() { double a[2]={20.0, 25.0}, *p, *q; p = a; q = p + 1; printf("%d,%d", (int)(q - p), (int)(*q - *p)); return 0;}

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

Answer (B)

Answer from the official GATE CS 2024 answer key.

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