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

为啥运行不了?

struct Student
{
    int math;
    int english;
}

int main(int argc,char **argv)
{
    struct Student stu[50];

    //为其中一个学生的成绩赋值
    stu[20].math = 90;
    stu[20].english = 95;

    return 0;
}


正在回答

4 回答

你的struct是错的,在大括号之后需要加 ; 

0 回复 有任何疑惑可以回复我~
struct Student
{
    int math;
    int english;
};

int main(int argc,char **argv)
{
    struct Student stu[50];

    //为其中一个学生的成绩赋值
    stu[20].math = 90;
    stu[20].english = 95;

    return 0;
}

你只要在代码

struct Student
{
    int math;
    int english;
};(这里加上一个分号‘;’就行了)


0 回复 有任何疑惑可以回复我~

struct Student

{

int math;

int english;

};

int main(int argv,char **argv)

{

struct Student stu[50];

stu[20].math=93;

stu[20].english=95;

return 0;

}

0 回复 有任何疑惑可以回复我~
#1

weixin_慕UI5047479

这里的代码也是有问题的。需要把int main(int argv,char **argv)改为int main(int argc,char **argv)
2022-12-28 回复 有任何疑惑可以回复我~

举报

0/150
提交
取消

为啥运行不了?

我要回答 关注问题
意见反馈 帮助中心 APP下载
官方微信