title: Calling main from another function
body: <p>I am new to C, so forgive me if this query is basic.</p>
  
  <p>I want to call main() from another function, and make the program run infinitely. The code is here:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  void message();
  
  int main()
  {
      message();
  
      return 0;
  }
  
  void message()
  {
      printf("This is a test message. \n");
  
      main();
  }
  </code></pre>
  
  <p>I expect to see this program run infinitely. However, it runs for some time and then stops suddenly. Using a counter variable, which I printed alongside the test message, I found that the statement "This is a test message." is printed 174608 times after which I get an error message </p>
  
  <blockquote>
    <p>Segmentation fault (core dumped)</p>
  </blockquote>
  
  <p>and the program terminates. What does this error mean? And why does the program only run 174608 times (why not infinitely)?</p>