#include <stdio.h>
struct emp
{
char n[20];
int age;
};
int main(void)
{
struct emp e1 = {"David", 23};
struct emp e2;
scanf("%s %d", e2.n, e2.age);
if(structcmp(e1, e2) == 0)
printf("Equal structs.");
else
printf("Unequal structs.");
}
structcmp (struct emp x, struct emp y)
{
if(x.n == y.n)
if(x.age == y.age)
return 0;
return 1;
}
C语言 出现下列问题 但是不知道怎么改动
- 写回答
- 好问题 0 提建议
- 追加酬金
- 关注问题
- 邀请回答
-
3条回答 默认 最新
- 书山客 2022-01-06 14:59关注
#include <stdio.h> struct emp { char n[20]; int age; }; int structcmp(struct emp x, struct emp y) { if (x.n == y.n) if (x.age == y.age) return 0; return 1; } int main(void) { struct emp e1 = { "David", 23 }; struct emp e2 = { "", 0 }; scanf("%s %d", e2.n, e2.age); if (structcmp(e1, e2) == 0) printf("Equal structs."); else printf("Unequal structs."); }
本回答被题主选为最佳回答 , 对您是否有帮助呢?解决 无用评论 打赏 举报
悬赏问题
- ¥15 请问为什么我配置IPsec后PC1 ping不通 PC2,抓包出来数据包也并没有被加密
- ¥200 求博主教我搞定neo4j简易问答系统,有偿
- ¥15 nginx的使用与作用
- ¥100 关于#VijeoCitect#的问题,如何解决?(标签-ar|关键词-数据类型)
- ¥15 一个矿井排水监控系统的plc梯形图,求各程序段都是什么意思
- ¥50 安卓10如何在没有root权限的情况下设置开机自动启动指定app?
- ¥15 ats2837 spi2从机的代码
- ¥200 wsl2 vllm qwen1.5部署问题
- ¥100 有偿求数字经济对经贸的影响机制的一个数学模型,弄不出来已经快要碎掉了
- ¥15 数学建模数学建模需要