鱼C论坛

 找回密码
 立即注册
查看: 806|回复: 10

[已解决]这是什么问题

[复制链接]
发表于 2021-12-21 15:44:26 | 显示全部楼层 |阅读模式

马上注册,结交更多好友,享用更多功能^_^

您需要 登录 才可以下载或查看,没有账号?立即注册

x
这是什么问题 求解答
最佳答案
2021-12-21 16:24:24
我用gcc试了一下你的代码,没有问题
#include <stdio.h>

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

int main(int argc, char const *argv[]){
        struct date today = {12, 21, 2021};
        struct date thismonth = {.month = 12, .year = 2021};
        printf("xxxxx %i %i %i\n", today.year, today.month, today.day);
        printf("xxxx %i %i %i", thismonth.year, thismonth.month, thismonth.day);
        return 0;
}
360截图20211221154304435.jpg
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-12-21 15:51:31 From FishC Mobile | 显示全部楼层
int main(int argc, const char *argv[])
你写错了,如果不熟悉,就不要放参数!
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-12-21 15:57:37 | 显示全部楼层
傻眼貓咪 发表于 2021-12-21 15:51
int main(int argc, const char *argv[])
你写错了,如果不熟悉,就不要放参数!

改了 不放参数还是不对啊
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-12-21 16:09:52 From FishC Mobile | 显示全部楼层
还是不能就表示 int main(int argc, char const *argv[]) 没有错,错可能是你的结构类型
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-12-21 16:12:01 From FishC Mobile | 显示全部楼层
.day = ?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复

使用道具 举报

发表于 2021-12-21 16:24:24 From FishC Mobile | 显示全部楼层    本楼为最佳答案   
我用gcc试了一下你的代码,没有问题
#include <stdio.h>

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

int main(int argc, char const *argv[]){
        struct date today = {12, 21, 2021};
        struct date thismonth = {.month = 12, .year = 2021};
        printf("xxxxx %i %i %i\n", today.year, today.month, today.day);
        printf("xxxx %i %i %i", thismonth.year, thismonth.month, thismonth.day);
        return 0;
}
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-12-21 21:03:52 | 显示全部楼层
傻眼貓咪 发表于 2021-12-21 16:24
我用gcc试了一下你的代码,没有问题

是dev c++的问题吗  我用dev c++编译不行
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-12-21 21:07:03 | 显示全部楼层
LeaflLit 发表于 2021-12-21 21:03
是dev c++的问题吗  我用dev c++编译不行

能支持 C99 吗?
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-12-21 21:24:46 | 显示全部楼层

刚下了dev c++ 6.3 程序可以了
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

 楼主| 发表于 2021-12-21 21:25:26 | 显示全部楼层
LeaflLit 发表于 2021-12-21 21:24
刚下了dev c++ 6.3 程序可以了

感谢
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

发表于 2021-12-21 21:28:58 | 显示全部楼层
想知道小甲鱼最近在做啥?请访问 -> ilovefishc.com
回复 支持 反对

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

小黑屋|手机版|Archiver|鱼C工作室 ( 粤ICP备18085999号-1 | 粤公网安备 44051102000585号)

GMT+8, 2024-9-28 06:13

Powered by Discuz! X3.4

© 2001-2023 Discuz! Team.

快速回复 返回顶部 返回列表