title: length of dynamic array in c++
body: <blockquote>
    <p><strong>Possible Duplicate:</strong><br>
    <a href="https://stackoverflow.com/questions/492384/how-to-find-the-sizeofa-pointer-pointing-to-an-array">How to find the sizeof(a pointer pointing to an array)</a>  </p>
  </blockquote>
  
  
  
  <p>I declared a dynamic array like this:</p>
  
  <pre><code>int *arr = new int[n];   //n is entered by user 
  </code></pre>
  
  <p>Then used this to find length of array:</p>
  
  <pre><code>int len = sizeof(arr)/sizeof(int);
  </code></pre>
  
  <p>It gives <code>len</code> as <code>1</code> instead of <code>n</code> . Why is it so?</p>