GATE CS 2026 Set 2 | Question 60

Programming & Data Structures › Pointers · NAT · 2 marks · Answer: 9

  1. Question 60Programming & Data Structuresnat2 marks
    Consider the following ANSI-C program.
    c
    #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)

    Answer: 9

    Solution

    ptr=&a; *ptr=c; sets . ptr=&c; now points to . a=*(&b); sets . c=*ptr-a . So the program prints .

More GATE PYQ on Pointers

All GATE CS Programming & Data Structures PYQ →

Attempt GATE CS 2026 Set 2 in real GATE exam mode

Full paper with a timer, the GATE interface and a topic-wise analysis — free.

Create free account →