Question:medium

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

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 Hint

Remember that static} variables inside a function preserve their value between successive calls. This is often tested in C programming exam questions.
Updated On: Jan 31, 2026
Show Solution

Correct Answer: 7

Solution and Explanation

Was this answer helpful?
0

Top Questions on Engineering Mathematics