title: Why is an array's dimension part of its type?
body: <p>While reading the C++ Primer book, I came across this statement: "The number of elements in an array is part of the array's type." So I wanted to find out using the following code:</p>
  
  <pre><code>#include&lt;iostream&gt;
  
  int main()
  {
      char Array1[]{'H', 'e', 'l', 'p'};
      char Array2[]{'P', 'l', 'e', 'a', 's', 'e'};
  
      std::cout&lt;&lt;typeid(Array1).name()&lt;&lt;std::endl;        //prints  A4_c
      std::cout&lt;&lt;typeid(Array2).name()&lt;&lt;std::endl;        //prints  A6_c
  
      return 0;
  }
  </code></pre>
  
  <p>And interestingly the result of typeid on the two arrays showed they are somehow different. </p>
  
  <ul>
  <li>What's going on behind the scenes?</li>
  <li>Why is it necessary to for array's to have a type that includes its size? Is it just because its size should not change?</li>
  <li>How will this affect comparing arrays?</li>
  </ul>
  
  <p>Just want to be able to deeply understand the concept.</p>