title: My code stops at a certain condition
body: <p>In this code I input a test case number t and then input t numbers (n). Then my code prints the nth prime number. In the 1st line of the function, prime(), if I write <code>if(a &gt; 43000) return;</code> Then the code works perfectly. But if I write <code>if(a &gt;= 165000) return;</code> in the same place, codeblocks says the program has stopped working. But I can't understand why.</p>
  
  <pre><code>#include &lt;iostream&gt;
  #include &lt;cmath&gt;
  using namespace std;
  int p[15000];
  void prime(int a, int i)
  {
      if(a &gt;= 165000) return;
      else {
          int q = 0;
          int s=sqrt(a), d=3;
          while(d&lt;=s){
              if(a % d == 0) {
                  q = 1;
              }
              d += 2;
          }
          if(q == 0) {
              p[i] = a;
              i++;
              a += 2;
              prime(a, i);
          }
          else {
              a += 2;
              prime(a, i);
          }
      }
  }
  int main()
  {
      p[0]=2;
      prime(3, 1);
      int k, T;
      cin &gt;&gt; T;
      for(int i = 1; i &lt;= T; i++){
          cin &gt;&gt; k;
          cout &lt;&lt; p[k - 1] &lt;&lt; endl;
      }
      return 0;
  }
  </code></pre>