Which of the following statements are correct about the below program?
#include <stdio.h>
int main()
{
int i = 0;
i++;
if(i <= 5)
{
printf("IndiaBIX\n");
exit(0);
main();
}
return 0;
}
Answer: B
Correct answer: The program prints 'IndiaBIX' one time
exit(0) terminates the program immediately. The recursive main() call written after it is never reached, so the message is printed exactly once. (Calling main recursively is legal in C, which is why the last option is wrong - it just never happens here.)
Please log in or register to report this question.