Skip to content
Related Articles

Related Articles

C | Storage Classes and Type Qualifiers | Question 3
  • Difficulty Level : Easy
  • Last Updated : 09 Feb, 2013




#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

Want to learn from the best curated videos and practice problems, check out the C Foundation Course for Basic to Advanced C.
My Personal Notes arrow_drop_up
Recommended Articles
Page :