GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2026 set2

GATE 2026 set2 · CS · NAT · 2 marks · Programming and Data Structures › C Programming Fundamentals

GATE 2026 set2 Computer Science and Information Technology question: Consider the following ANSI-C program. code The output of this program is . (answer in…

Consider the following ANSI-C program.

#include <stdio.h>
int main(){
  int *ptr, a, b, c;
  a=5; b=11; c=20;
  ptr=&a; *ptr=c; ptr=&c;
  a=*(&b); c=*ptr-a;
  printf("%d",c);
  return(0);
}

The output of this program is ____________. (answer in integer)

Note: Assume that the program compiles and runs successfully.

Show answer

Official answer: 9

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion