title: struct initialization in C
body: <p>Before you mark it as a duplicate/downvote, <strong>I have read books, spend decent amount of time on Internet researching this, but I CANNOT find an answer.</strong></p>
  
  <p>I want to initialize my struct when I create it. But I also want to declare it as a type using typedef</p>
  
  <p>Here is what I am trying to do</p>
  
  <pre><code>typedef struct Clock_TAG Clock;
  
  struct Clock_TAG{
    int time;
  }Clock = {
    0
  };
  </code></pre>
  
  <p>And it gives me an error "redefinition of 'Clock' as different kind of symbol"</p>
  
  <pre><code>typedef struct Clock_TAG{
   int time;
  }Clock = {
    0
  };
  </code></pre>
  
  <p>Gives "illegal initializer (only variables can be initialized)"</p>
  
  <p>I know I have to use the name of the struct in order to initialize it, I want to initialize it at the time of it's creation, so please do not suggest having an init() method. </p>
  
  <p>This is an example code, <strong>I want to specifically understand HOW I can have a typedef AND struct initialization in the .h file</strong>
  I know there are many ways around this, I can omit using typedef or initialize the struct members the other way, but I want to understand why this gives me an error and how to fix it. </p>
  
  <p>P.S
  Is it also legal to malloc the struct in .h file?</p>