GATE Assistant

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

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

GATE 2025 set2 Computer Science and Information Technology question: Consider the following C program: code The output of the above program is . (Answer in…

Consider the following C program:

#include <stdio.h>
int main(){
    int a;
    int arr[5] = {30,50,10};
    int *ptr;
    ptr = &arr[0] + 1;
    a = *ptr;
    (*ptr)++;
    ptr++;
    printf("%d", a + (*ptr) + arr[1]);
    return 0;
}

The output of the above program is ___________. (Answer in integer)

Show answer

Official answer: 111

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion