title: Pointers: Expression is not assignable
body: <p>I'm writing a function whose purpose is to change the value of struct variables. I'm getting error messages that say the expressions toward the end of my first function are not assignable. How, then, do I have the function change the values of the daate structure?</p>
  
  <p>Here's my code:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #include &lt;stdbool.h&gt;
  
  struct date
  {
      int month;
      int day;
      int year;
  };
  
  struct date dateUpdate (struct date *dait) {
      struct date tomorrow;
      int numberOfDays (struct date d);
  
      if (dait-&gt;day != numberOfDays (*dait) ) {
          tomorrow.day = dait-&gt;day + 1;
          tomorrow.month = dait-&gt;month;
          tomorrow.year = dait-&gt;year;
      }
      else if ( dait-&gt;month == 12 ) { //end of year
          tomorrow.day = 1;
          tomorrow.month = 1;
          tomorrow.year = dait-&gt;year + 1;
      }
      else { //end of month
          tomorrow.day = 1;
          tomorrow.month = dait-&gt;month + 1;
          tomorrow.year = dait-&gt;year;
      }
  
      &amp;dait-&gt;day = tomorrow.day;
      &amp;dait-&gt;month = tomorrow.month;
      &amp;dait-&gt;year = tomorrow.year;
  
      return *dait;
  }
  
  //Function to find the number of days in a month;
  
  int numberOfDays (struct date d)
  {
      int days;
      bool isLeapYear (struct date d);
      const int daysPerMonth[12] = 
      { 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31 };
  
      if ( isLeapYear (d) &amp;&amp; d.month == 2 )
          days = 29;
      else
          days = daysPerMonth[d.month - 1];
  
      return days;
  }
  
  }
  
  int main (void) {
      struct date daate;
      daate.day = 21;
      daate.month = 6;
      daate.year = 2013;
  
      dateUpdate(&amp;daate);
      printf("%d", daate.day);
  }
  </code></pre>