GATE Assistant

Past questions › Computer Science and Information Technology › GATE 2023

GATE 2023 · CS · NAT · 1 mark · Programming and Data Structures › C Programming Fundamentals

GATE 2023 Computer Science and Information Technology question: The integer value printed by the ANSI-C program given below is . code

The integer value printed by the ANSI-C program given below is ______.

#include<stdio.h>

int funcp(){
        static int x = 1;
        x++;
        return x;
}

int main(){
        int x,y;
        x = funcp();
        y = funcp()+x;
        printf("%d\n", (x+y));
        return 0;
}
Show answer

Official answer: 7

Practise this question with exam-style marking

Discussion

No discussion yet.

Join the discussion