永发信息网

这段程序有两处错误,编译提示C2679和C2440 请诸位高手帮忙解释一下 小弟不胜感激

答案:1  悬赏:50  手机版
解决时间 2021-02-03 02:17
  • 提问者网友:富士山上尢
  • 2021-02-02 15:33
typedef struct point
{

int number;
char information[60];
} point;

typedef struct school
{
struct point vexs[10];
int arcs[10][10];
} school;
void main()
{

char ch;
school tu;
tu.vexs[10] = ((1,"Our front door,it is very beautiful."),
(2,"Our main building,it has seven blord"),
( 3,"it is the restaurant,we all like there very much"),
( 4,"sprot ground has 12 basketball ground and a football ground"),
(5,"students'hostel,there are 9 buildings"),
( 6,"teachers'hostel,there are 5 buildings"),
(7,"budiness street,a lot of shop,not beautfil,but lively"),
(8,"this pond can feed fish"),
(9,"beauful library,and so many books"),
(10, "many trees ,many brids"));
tu.arcs = ((0,2,0,0,0,0,0,0,0,0),(2,0,1,2,2,0,0,0,0,0,0),(0,1,0,0,0,1,0,0,0,0),(0,2,0,0,1,0,1,0,0,0),(0,2,0,1,0,1,1,1,0,0),(0,0,1,0,1,0,0,0,1,0),(0,0,0,1,1,0,0,0,0,0),(0,0,0,0,1,0,0,0,1,1),(0,0,0,0,0,1,0,1,0,0),(0,0,0,0,0,0,0,1,0,0));
最佳答案
  • 五星知识达人网友:怙棘
  • 2021-02-02 16:14
你没有把初始化和赋值区分开。
参考一下:
point p={1,"abc"};//正确(初始化)
point p1[]={{1,"abc"},{2,"cba"}};//正确(初始化)
point p3;
p3={1,"abc"};//错误(赋值)
p3.number =1;//正确(赋值)
p3.information ="abc";//错误(赋值)
strcpy(p3.information ,"abc");//正确(赋值)
我要举报
如以上回答内容为低俗、色情、不良、暴力、侵权、涉及违法等信息,可以点下面链接进行举报!
点此我要举报以上问答信息
大家都在看
推荐资讯