Skip to content
Related Articles
Get the best out of our app
GeeksforGeeks App
Open App
geeksforgeeks
Browser
Continue

Related Articles

C | Storage Classes and Type Qualifiers | Question 3

Improve Article
Save Article
Like Article
Improve Article
Save Article
Like Article




#include <stdio.h>
int main()
{
    static int i=5;
    if (--i){
        printf("%d ",i);
        main();
    }
}

(A) 4 3 2 1
(B) 1 2 3 4
(C) 4 4 4 4
(D) 0 0 0 0


Answer: (A)

Explanation: Since i is static variable, it is shared among all calls to main(). So is reduced by 1 by every function call.

Quiz of this Question

My Personal Notes arrow_drop_up
Last Updated : 28 Jun, 2021
Like Article
Save Article
Similar Reads