为了账号安全,请及时绑定邮箱和手机立即绑定

出现Error executing xicl6.exe.?为什么会这样?

出现Error executing xicl6.exe.?为什么会这样?

千万里不及你 2022-05-13 14:11:34
#include<stdio.h>#include<string.h>#include<stdlib.h>struct boom{int x;char y[10];};void B(boom &T);void main(){boom T[10];for(int i=0;i<10;i++){scanf("%d %s",&T[i].x,T[i].y);printf("%d %s\n",T[i].x,T[i].y);}B(T[10]);}void B(boom &T){boom T1;scanf("%d %s",&T1.x,T1.y);for(int i=0;i<10;i++){if(strcmp(T[i].y,T1.y)==0){printf("hhhhh\n");exit(0);}}}C:\Documents and Settings\Administrator\桌面\Text1.cpp(26) : error C2676: binary '[' : 'struct boom' does not define this operator or a conversion to a type acceptable to the predefined operatorC:\Documents and Settings\Administrator\桌面\Text1.cpp(26) : error C2228: left of '.y' must have class/struct/union typeError executing xicl6.exe.
查看完整描述

2 回答

?
隔江千里

TA贡献1906条经验 获得超10个赞

void B(boom &T),这个函数期望参数是一个boom引用,而你传入的是一个级数头指针。

查看完整回答
反对 回复 2022-05-16
?
慕沐林林

TA贡献2016条经验 获得超9个赞

试试 把 &T[i].y 改成 &((T[i]).y)

查看完整回答
反对 回复 2022-05-16
  • 2 回答
  • 0 关注
  • 198 浏览

添加回答

举报

0/150
提交
取消
微信客服

购课补贴
联系客服咨询优惠详情

帮助反馈 APP下载

慕课网APP
您的移动学习伙伴

公众号

扫描二维码
关注慕课网微信公众号