这是一个计算下一天日期程序。问题出现在函数部分复合字面量地方出现语法错误,找了很久,没发现解决办法,请帮我指出一下。
struct date
{
int month;
int year;
int day;
};
struct date update(struct date today)
{
struct date tomorrow;
const int dayspermonth[12]={31,28,31,30,31,30,31,31,30,31,30,31};
int days;
if(today.year%4==0&&today.year%100!=0||today.year%400==0&&today.month==2)
days=29;
else
days=dayspermonth[today.month-1];
if(today.day!=days)
tomorrow=(struct date){today.month,today.day+1,today.year};
else if (today.month==12)
tomorrow=(struct date){1,1,today.year+1};
else
tomorrow=(struct date){today.monnth+1,1,today.year};
return tomorrow;
}
int main(void)
{
struct date thisdate,nextdate;
struct date update(struct date today);
printf("Input date's date (mm dd yyyy)");
scanf("%i:%i:%i",&thisdate.month,&thisdate.day,&thisdate.year);
nextdate=update(thisdate);
printf("%i:%i:%i",nextdate.month,nextdate.day,nextdate.year);
return 0;
}