c语言 In function 'int main(int, const char**)':

#include

struct date {
int month;
int day;
int year;
};

int main(int argc, char const *argv[])
{
struct date today = {03,17,2019};
struct date thismonth = {.month=3, .year=2019};

printf("Today's date is %i-%i-%i.\n",
        today.year,today.month,today.day);
printf("This month is %i-%i-%i.\n",
        thismonth.year,thismonth.month,thismonth.day);

return 0;

}

初学者QWQ打扰啦

图片说明

1个回答

struct date today = {03,17,2019};不是所有编译器都支持这么写
你可以用标准写法
date today;
today.month = 3;
today.day = 17;
today.tear = 2019;

下面的类似

voice34
瓜瓜今天有猫了吗 谢谢!
一年多之前 回复
Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问