Skip to content
Snippets Groups Projects
Select Git revision
  • 42f97a8e224ae8b712b92e0ec327d7f9d9414922
  • main default protected
  • increase_steps
  • auto_mutation
4 results

main.py

Blame
  • incdate-4.c 552 B
    #include <stdio.h>
    
    typedef struct
    {
      char day, month;
      int year;
    }
    date;
    
    void set_date (date *d)
    {
      d->day = 30;
      d->month = 4;
      d->year = 2012;
    }
    
    void inc_date (date *d)
    {
      d->day++;
      int days_in_month = 31;  /* FIXME */
      if (d->day > days_in_month)
        {
          d->month++;
          d->day = 1;
          if (d->month > 12)
            {
              d->year++;
              d->month = 1;
            }
        }
    }
    
    int main (void)
    {
      date today;
      set_date (&today);
      inc_date (&today);
      printf ("%d.%d.%d\n", today.day, today.month, today.year);
      return 0;
    }