title: C++ iterate an array of integers whose size is unknown?
body: <p>I have the following array:</p>
  
  <pre><code>int* myArray = new int[45];
  </code></pre>
  
  <p>If I wanted to iterate each element without knowing the actual size of the array, I would need to use a <code>for_each</code>?</p>
  
  <p>If so, then how would you write the <code>for_each</code>? I was looking over the following site and reading up on for_each but can't figure out how to put this together.</p>
  
  <p><a href="http://www.cplusplus.com/reference/algorithm/for_each/" rel="nofollow noreferrer">http://www.cplusplus.com/reference/algorithm/for_each/</a></p>
  
  <hr>
  
  <p><strong>Update:</strong> A <code>for_each</code> is not a good choice in this case, due to the fact that the size of the array has to be known. vectors are the proper way to accomplish such task. My reason for using arrays, in this case, was for learning purposes. if this was a serious project I would move to something such as Lists/Vectors.</p>