title: What is the rationale behind tentative definitions in C?
body: <p>Consider following program. Will this give any compilation errors?</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  int s=5;
  int s;
  int main(void)
  {
       printf("%d",s);
  }
  </code></pre>
  
  <p>At first glance it seems that compiler will give variable redefinition error but program is perfectly valid according to C standard. (See live demo here <a href="http://ideone.com/Xyo5SY" rel="noreferrer">http://ideone.com/Xyo5SY</a>).</p>
  
  <p>A tentative definition is any external data declaration that has no storage class specifier and no initializer.</p>
  
  <p>C99 6.9.2/2</p>
  
  <blockquote>
    <p>A declaration of an identiﬁer for an object that has ﬁle scope without
    an initializer, and without a storage-class speciﬁer or with the
    storage-class speciﬁer static, constitutes a tentative deﬁnition. If a
    translation unit contains one or more tentative deﬁnitions for an
    identiﬁer, and the translation unit contains no external deﬁnition for
    that identiﬁer, then the behavior is exactly as if the translation
    unit contains a ﬁle scope declaration of that identiﬁer, with the
    composite type as of the end of the translation unit, with an
    initializer equal to 0.</p>
  </blockquote>
  
  <p>My question is, what is rationale for allowing tentative definitions? Is there any use of this in C? Why does C allow tentative definitions?</p>