#includestruct student{int num;char name[10];int score;};void f(struct student st){st.score++;}void main(){ struct student st={200,"chenchen",76};f(st);printf("%d",st.score);}为什么最后输出的是76?不是加了1,不应该是77吗?

来源:学生作业帮助网 编辑:六六作业网 时间:2024/12/20 06:11:14
#includestructstudent{intnum;charname[10];intscore;};voidf(structstudentst){st.score++;}voidmain(){s

#includestruct student{int num;char name[10];int score;};void f(struct student st){st.score++;}void main(){ struct student st={200,"chenchen",76};f(st);printf("%d",st.score);}为什么最后输出的是76?不是加了1,不应该是77吗?
#include
struct student{int num;char name[10];int score;};
void f(struct student st){st.score++;}
void main()
{ struct student st={200,"chenchen",76};
f(st);
printf("%d",st.score);
}
为什么最后输出的是76?不是加了1,不应该是77吗?

#includestruct student{int num;char name[10];int score;};void f(struct student st){st.score++;}void main(){ struct student st={200,"chenchen",76};f(st);printf("%d",st.score);}为什么最后输出的是76?不是加了1,不应该是77吗?
#include
struct student{int num;char name[10];int score;};
struct student st={200,"chenchen",76};
void f(void){st.score++;}
void main()
{
f();
printf("%d",st.score);
}
这样就好了
你的那个,f中的st是参变量加多少都不会改变最后的结果