Determine Output:
void main(){ static int var = 5; printf("%d ", var--); if(var) main();}

Determine Output:

void main(){ static int var = 5; printf("%d ", var--); if(var) main();}
Correct Answer 5 4 3 2 1

When static storage class is given, it is initialized once. The change in the value of a static variable is retained even between the function calls. Main is also treated like any other ordinary function, which can be called recursively.

Related Questions

Comment on the following 2 C programs.
#include  //Program 1int main(){ int a; int b; int c;}#include  //Program 2int main(){ int a; { int b; } { int c; }}