title: Program demonstrating structures does not receive correct input values
body: <p>This simple program demonstrates the use of structures by determining tomorrow's date.  It asks for an input of today's date:</p>
  
  <pre><code>#include    &lt;stdlib.h&gt;
  #include    &lt;stdio.h&gt;
  
  int main ( int argc, char *argv[] )
  {
  
      struct date {
          int month;
          int day;
          int year;
      };  /* ----------  end of struct date  ---------- */
  
      struct date today, tomorrow;
  
      const int   daysPerMonth[12] = { 31, 28, 31, 30, 31, 30,
                           31, 31, 30, 31, 30, 31 };
  
      printf ( "Enter today's date (mm dd yyyy): \n" );
      scanf ( "%i%i%i", &amp;today.month, &amp;today.day, &amp;today.year );
  
      if ( today.day != daysPerMonth[today.month - 1] ) {
          tomorrow.day = today.day + 1;
          tomorrow.month = today.month;
          tomorrow.year = today.year;
      }
      else if ( today.month == 12 ) {         /* end of year */
          tomorrow.day = 1;
          tomorrow.month = 1;
          tomorrow.year = today.year + 1;
      }
      else {                                  /* end of month */
          tomorrow.day = 1;
          tomorrow.month = today.month + 1;
          tomorrow.year = today.year;
      }
  
      printf ( "Tomorrow's date is %i/%i/%.2i.\n", tomorrow.month,
            tomorrow.day, tomorrow.year % 100 );
  
      return EXIT_SUCCESS;
  }       /* ----------  end of function main  ---------- */
  </code></pre>
  
  <p>When running it, what I got:</p>
  
  <blockquote>
    <p>Enter today's date (mm dd yyyy): </p>
  
  <pre><code>06 09 2014
  </code></pre>
    
    <p>Tomorrow's date is 6/1/09.</p>
  </blockquote>
  
  <p>But when I run gdb and printed out the input values:</p>
  
  <pre><code>(gdb) p today.month
  
  $1 = 6
  
  (gdb) p today.day
  
  $2 = 0
  
  (gdb) p today.year
  
  $3 = 9 
  </code></pre>
  
  <p>I'm confused.  Why is the input getting incorrect values like that?</p>