What will be the output of the following program on GCC?
int main(){
static int c=5;
printf("c=%d",c--);
if(c)
main();
return 0;
}
The storage class of `c` is `static` means it can`t be re-initialized. The printf() prints the value of `c`
i.e. 5 then post decrement operator decrements it to 4. The if condition is c i.e. 4. This evaluates to true and main() is called.
This time `c` is not re-initialized to 5 i.e. it is still 4 and the printf() prints the value 4.
In the same manner, value is printed till c=1 i.e. when `c` is decremented from 1 to 0, then if condition evaluates to false.