Interview Question 3528
Created by admin on Sat, 17/11/2012 - 11:51
Explanation:
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.
Question:
main()
{
static int var = 5;
printf("%d ",var--);
if(var) main();
}
Language:
Answer:
5 4 3 2 1.