title: c define struct in another c file
body: <p>I have delcared a struct in my header file and now i want to define an array of this struct in another c-file to seperate it from my main c-file.
  The definition of the components is not possible in the second c-file the way i try it (see code below). How can I define the struct in another c-file (or h-file, but i think there should be no definitions in h-files).</p>
  
  <p>main.c</p>
  
  <pre><code>#include "struct.h"
  int main(void)
  {
      printf("%s",room[0].name);
      return 0;
  }
  </code></pre>
  
  <p>struct.h</p>
  
  <pre><code>struct RoomStruct
  {
      char name[20];
      int rRight, rLeft, rFront, rBack, rUp, rDown;
  };
  typedef struct RoomStruct Room;
  
  extern Room rooms[20];
  </code></pre>
  
  <p>struct.c</p>
  
  <pre><code>#include &lt;string.h&gt;
  
  #include "struct.h"
  
  Room rooms[20];
  
  strcpy(rooms[0].name,"firstRoom");
  rooms[0].rLeft = 1;
  </code></pre>