title: how can i check array length in a function?
body: <p>In my file I have created function length that must return length of auto type array, but instead of right answer it everytime returns 1.</p>
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  int length(auto arr){
      return sizeof(arr) / sizeof(*arr);
  }
  
  int main(){
      int arr[] = {1,2,3,4,5,0};
      // Test
      cout &lt;&lt; length(arr); // it returns 1 but the right answer is 6
      return 0;
  }
  </code></pre>