title: Why do C and C++ compilers allow array lengths in function signatures when they're never enforced?
body: <p>This is what I found during my learning period:</p>
  
  <pre><code>#include&lt;iostream&gt;
  using namespace std;
  int dis(char a[1])
  {
      int length = strlen(a);
      char c = a[2];
      return length;
  }
  int main()
  {
      char b[4] = "abc";
      int c = dis(b);
      cout &lt;&lt; c;
      return 0;
  }  
  </code></pre>
  
  <p>So in the variable <code>int dis(char a[1])</code> , the <code>[1]</code> seems to do nothing and doesn't work at<br>
  all, because I can use <code>a[2]</code>.  Just like <code>int a[]</code> or <code>char *a</code>. I know the array name is a pointer and how to convey an array, so my puzzle is not about this part. </p>
  
  <p>What I want to know is why compilers allow this behavior (<code>int a[1]</code>). Or does it have other meanings that I don't know about?</p>