Open In App

C | Storage Classes and Type Qualifiers | Question 3




#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

Article Tags :