Skip to content
Related Articles

Related Articles

Improve Article
Save Article
Like Article

C | Storage Classes and Type Qualifiers | Question 3

  • Difficulty Level : Easy
  • Last Updated : 28 Jun, 2021




#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
Recommended Articles
Page :

Start Your Coding Journey Now!