Q. Assuming int size is 4 bytes, what is going to happen when we compile and run the following program?

Code:
#include “stdio.h”
int main()
{
  printf(“GeeksQuizn”);
  main();
  return 0;
}
  • (A) We can’t use main() inside main() and compiler will catch it by showing compiler error.
  • (B) GeeksQuiz would be printed in 2147483647 times i.e. (2 to the power 31) - 1.
  • (C) It’ll print GeeksQuiz infinite times i.e. the program will continue to run forever until it’s terminated by other means such as CTRL+C or CTRL+Z etc.
  • (D) GeeksQuiz would be printed until stack overflow happens for this program.
πŸ’¬ Discuss
βœ… Correct Answer: (D) GeeksQuiz would be printed until stack overflow happens for this program.

You must be Logged in to update hint/solution

πŸ’¬ Discussion


πŸ“Š Question Analytics

πŸ‘οΈ
212
Total Visits
πŸ“½οΈ
3 y ago
Published
πŸŽ–οΈ
Ram Sharma
Publisher
πŸ“ˆ
95%
Success Rate