title: How to declare not yet defined static variable in C
body: <p>How to declare static variable prior to its definition? The use case is there is other global variable is using it before it is defined. And I don't want to move the definition to top.</p>
  
  <p>Example code:</p>
  
  <pre><code>extern static int a; //compiler error, but I need to declare 'a' because it is used below by 'x'
  
  typedef struct{
   int * dd;
  }X;
  
  static X x={&amp;a}; //this variable needs to use 'a'
  
  static int a=5; //this is where 'a' defined
  </code></pre>
  
  <p>Above code is compile error.</p>
  
  <p><strong>=== Update ====</strong></p>
  
  <p>Well, I found the solution myself. Just remove the <code>extern</code> keyword.</p>