C++ iterate an array of integers whose size is unknown?
<p>I have an array as so:</p>

<p>int* myArray = new int[45];</p>

<p>Now, if i want to iterate through each element, without knowing the actual size of the array i would use a <code>for_each</code> correct?</p>

<p>If so, then how would you write the for_each? 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">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 is for learning purposes, if this was a serious project i would definitely move to something such as Lists/Vectors.</p>

<p>Thanks!</p>
