title: Array Split in C++
body: <p>I am trying to split an array, and this is how I am doing it:</p>
  
  <pre><code>int arr1[] = {1, 2, 3, 4, 5};
  int *arr2 = arr1 + 1;
  </code></pre>
  
  <p>Now I need to do this in a loop. In every iteration, I am trying to decrease the size of the array by 1 element or 2 elements based on a condition. For obvious reasons I can't declare <code>int arr2[some_variable]</code> .</p>
  
  <p>But I want a new array to be created in every iteration of the loop whose size is 1 less than its parent array. I am not sure how I can achieve this. Can anyone help please? </p>
  
  <p>In Java, there is a function which can do this: <code>int newArr[] = Arrays.copyOfRange(arr, 1, arr.length);</code> I wanted something similar to this in C++.</p>