title: Int Array Length C++
body: <p>I have to use a dynamic length int array in my program, and want to be able to get the number of objects in it at various points in my code. I am not that familiar with C++, but here is what I have. Why is it not giving me the right length? Thanks.</p>
  
  <pre><code>&lt;#include &lt;iostream&gt;
  Using Namespace std;
  int length(int*);
  
  
  void main()
  {
    int temp[0];
    temp[0] = 7;
    temp [1] = 10;
    temp[2] = '\0';
  
    cout &lt;&lt; length(temp) &lt;&lt; endl;
  }
  
  int length(int* temp)
  {
      int i = 0;
      int count = 0;
  
      while (*temp + i != '\0')
      {
            count++;
            i++;
      }
      return count;
  }
  </code></pre>
  
  <p>currently it just goes into an endless loop ;_;</p>