title: How do you increase the stack size using MinGw G++ compiler?
body: <p>I am trying to run the <a href="https://en.wikipedia.org/wiki/Ackermann_function" rel="nofollow noreferrer">Ackermann function</a><sup>1</sup> and I am having an issue. I am trying to run the program through my Command Prompt, on a Windows 10 machine, and a few seconds after reaching the value pair (4,0) the program stops. I am assuming because it has run out of available resources, but I am not sure at all. Is there a way to fix this issue? TIA.</p>
  <p>I am using the MinGw G++ compiler [8.1.0].</p>
  <p><b>Here is the code in question as well.</b><br></p>
  <pre><code>#include &lt;iostream&gt;
  #include &lt;ctime&gt;
  
  int ack(int m, int n)
  {
      int ans;
      if (m == 0)
          ans = n + 1;
  
      else if (n == 0)
          ans = ack(m - 1, 1);
  
      else
          ans = ack(m - 1, ack(m, n - 1));
  
      return ans;
  }
  
  void runAck(time_t start) 
  {
      int answer;
      double seconds;
      time_t now_t;
  
      for(int i = 0; i &lt;= 6; i++)
      {
          for(int j = 0; j&lt;= 6; j++)
          {
              answer = ack(i, j);
              time(&amp;now_t);
              seconds = difftime(now_t, start);
              printf(&quot;Ackermann(%i, %i) is %i. Found in %.3f seconds.\n&quot;, i, j, answer, seconds);
          }
      }
  }
  
  int main()
  {
      std::cout &lt;&lt; &quot;Testing of the Ackermann recursion.&quot; &lt;&lt; std::endl;
      time_t start = time(NULL);
      runAck(start);
      
      return 0;
  }
  </code></pre>
  <p>I initially thought it was because I was using VSCode to access the command prompt but when I use it directly there is no change. While writing this question, I just thought of trying out a different OS or Ubuntu to see if there is any difference.</p>
  <p>My goal is just to get to (4,1) to see how much faster it is now to calculate.</p>
  <p><sup>1</sup> The Ackermann Function is a recursion function that was developed as computer theory to create a function that can only be calculated recursively.</p>
  <p><sup>Edit 1</sup> @MikeCAT helped me realize what I was truly asking and answered my question.</p>