title: struct in C: Error storage size of 'params' isn't known
body: <p>I'm a bit new to C and I'm having a bit of trouble with a project I'm currently working on. Essentially I have the following files: main.c, alarm.c, alarm.h</p>
  
  <p>I have a struct declaration in alarm.c that looks like:</p>
  
  <pre><code>#define STRLEN 150;
  
  struct alarmparams
  {
      char time[STRLEN];
      char duration[STRLEN];
      char snooze[STRLEN];
      char port[STRLEN];
  };
  </code></pre>
  
  <p>In main.c I have:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;string.h&gt;
  #include "alarm.h"
  
  int main(int argc, char *argv[])
  {   
      struct alarmparams params;
  
      printf("%s, %s\n", params.time, params.duration);
  }
  </code></pre>
  
  <p>And in alarm.h I have:</p>
  
  <pre><code>struct alarmparams;
  </code></pre>
  
  <p>Right now when I go to compile I get the following error:</p>
  
  <pre><code>error: storage size of ‘params’ isn’t known
  </code></pre>
  
  <p>I've looked through other posts regarding this error, so I have done a bit of research on this already. I've also tried some of the suggested solutions and it's either I get the exact same error or I got more on top of it. I'm at a lose as to how to fix this. </p>
  
  <p>Is there something I'm missing? Did I declare something incorrectly?</p>
  
  <p>In general should structs be declared in the header file or the c file? Or does it even matter? What's the different between:</p>
  
  <pre><code>struct foo {...};
  </code></pre>
  
  <p>and</p>
  
  <pre><code>typedef struct foo {...};
  </code></pre>