title: Error on memory allocation in c++
body: <p>I am writing code for bottom-up merge sort in c++, but this error occurs on a line where I am allocating memory to a pointer,</p>
  
  <pre><code>void merge(int *a, int low, int high, int mid,int max)
  {
     int i, j, k; 
     int *c=new int[max];   //error occurs here
     i = low;
     k = low;
     j = mid + 1;
     while (i &lt;= mid &amp;&amp; j &lt;= high)
     {
         if (a[i] &lt; a[j])
         {
             c[k] = a[i];
             k++;
             i++;
         }
         else
         {
             c[k] = a[j];
             k++;
             j++;
  
         }
     }
     while (i &lt;= mid)
     {
         c[k] = a[i];
  
         k++;
         i++;
     }
     while (j &lt;= high)
     {
         c[k] = a[j];
         k++;
         j++;
     }
     for (i = low; i &lt; k; i++)
     {
         a[i] = c[i];
     }
  }
  </code></pre>
  
  <p><img src="https://i.stack.imgur.com/Kxhsk.jpg" alt="error screen shot"></p>
  
  <p>What is the problem, looks like no more memory available??</p>