Tricky Programs

C program calling main() function

Calling main() function

This program illustrate the concept of calling main() function.

  • A main() function is a complex user defined function.
  • This program will call main() function recusrsively.
  • We have used static keyword because a static int variable remains in memory even while the program is running. In other words it retain the value of variable between multiple function calls.
  • A normal variable is destroyed when a function call where the variable is declared.

OUPUT

calling main() function


Comment below if you are facing any problem


Also read

C program to run both if and else condition
C program to print a statement without using semicolon(;)
C program sum of Two numbers without using + operator