if else in c:
What will be the output of this below program?
static int i=10;
it prints 10 to 1, and exits with out any run time crash.
it prints 10 to 1, and crashes at run time due to stack over flow.
it prints 10, and exits with out any run time error.
it prints 10 infinite times, and crashes at run time due to stack over flow.
This is an example of recursion, which breaks at some point of time. here main is calling itself and it is breaking the recursion once i reaches 0. Since i is a static variable, its value will be persisted between two function calls.
Back To Top