title: c program that runs itself using system
body: <p>I was learning about the function system() is stdlib.h and realized I could create a program that ran itself using system(). I wrote this code and tried it:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(){
      printf("x");
      system("./a.out");
  }
  </code></pre>
  
  <p>It print exactly 563 x's to console every time I run it before exiting normally (no errors). I would like to know what is stopping the program and where this number comes from as it seems very arbitrary to me. Thanks</p>
  
  <p>Thanks for the insight regarding this first program but I'm not convinced the system is stopping it because it is running out of resources for the following reason: I just wrote this new program and it has not yet stopped.</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdlib.h&gt;
  
  int main(){
      printf("x");
      system("./a.out");
      system("./a.out");
  }
  </code></pre>
  
  <p>Also, when I tried to open a new console window I got this error:</p>
  
  <pre><code>/.oh-my-zsh/lib/theme-and-appearance.zsh:24: fork failed: resource temporarily unavailable
  
  /.oh-my-zsh/oh-my-zsh.sh:57: fork failed: resource temporarily unavailable
  </code></pre>