title: Does the confliction between declaration and definition cause undefined behavior?
body: <p>For example, in one source file:</p>
  
  <pre><code>extern int a[10];
  int main()
  {
     (void)sizeof(a);
     return 0;
  }
  </code></pre>
  
  <p>and in a second source file we have:</p>
  
  <pre><code>int a[20];//different with the first source 
  </code></pre>
  
  <p>Does the code above cause <strong>undefined behavior</strong>? As far as I know, in <strong>C</strong> it says: </p>
  
  <blockquote>
    <p>All declarations that refer to the same object or function shall have <strong>compatible</strong> type; otherwise, the behavior is undefined.</p>
  </blockquote>
  
  <p>Are <code>int[10]</code> and <code>int[20]</code> compatible(in <code>c</code>'s view)? And what about <strong>C++</strong> standard? </p>
  
  <p>Besides, if there is no second source file, is it legal to use <code>sizeof(a)</code> (<code>a</code> has just a declaration) ?</p>