title: Structures: Undeclared identifiers
body: <p>I'm trying to use structures in my program and I'm getting a bunch of error messages saying that time1, time2, and hourDif are undeclared identifiers. I thought I declared these structures the way you are supposed to, so I am confused as to what the problem is.</p>
  
  <p>Here's the code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  
  struct time1 {
      int seconds1;
      int minutes1;
      int hours1;
  };
  
  struct time2 {
      int seconds2;
      int minutes2;
      int hours2;
  };
  
      int timeDif(time1, time2) {
          struct dif {
              int secDif = time2.seconds2 - time1.seconds1;
              int minDif = time2.minutes2 - time1.minutes1;
              int hourDif = time2.hours2 - time1.hours1;
          };
  
          printf("The difference is %d:%d:%d\n", hourDif, minDif, secDif);
      }
  
  
  
      int main(void) {
  
          printf("Enter seconds1 (ss)\n");
          scanf("%d", &amp;time1.seconds1);
  
          printf("Enter minutes1 (mm)\n");
          scanf("%d", &amp;time1.minutes1);
  
          printf("Enter hours1 (hh)\n");
          scanf("%d", &amp;time1.hours1);
  
          printf("Enter seconds2 (ss)\n");
          scanf("%d", &amp;time2.seconds2);
  
          printf("Enter minutes2 (mm)\n");
          scanf("%d", &amp;time2.minutes2);
  
          printf("Enter hours2 (hh)\n");
          scanf("%d", &amp;time2.hours2);
  
          timeDif(time1, time2);
  
      return 0;
  }
  </code></pre>