title: C++ Array Pass to Function gets cut off
body: <p>I am new to C/C++ and am learning about arrays. I just finished reading about passing arrays to functions, and am trying to implement it. I start off with an array <code>x[] = "Hello</code>, which of course has a <code>sizeof()</code> 6. But for some reason, when I pass it to my function, <code>listElements(char arr[])</code>, then I get <code>sizeof(arr)</code> equal to 4. Why is my array being cut off like this? </p>
  
  <p>Also, <code>sizeof(char)</code> on my compiler is 1.</p>
  
  <pre><code>#include &lt;iostream&gt;
  using namespace std;
  
  void listElements(char[]);
  
  int main(){
      char x[] = "Hello";
      cout &lt;&lt; sizeof(x) &lt;&lt; endl; // 6
      listElements(x);
      cin &gt;&gt; x[0];
      return 0;
  }
  
  void listElements(char arr[]){
      cout &lt;&lt; "Size of arr: " &lt;&lt; sizeof(arr) &lt;&lt; endl; // 4  &lt;--- why is this 4?
      cout &lt;&lt; "Size of char: " &lt;&lt; sizeof(char) &lt;&lt; endl; // 1
      for (int j = 0; j &lt; (sizeof(arr) / sizeof(char)); j++){
          cout &lt;&lt; arr[j] &lt;&lt; endl;
      }
      return;
  }
  </code></pre>