#define _CRT_SECURE_NO_WARNINGS 1
#include"stdio.h"
struct student {
char *name=NULL;
int years;
int score;
}stu[10];
int main() {
int n, y, z, i;
scanf("%d", &n);
for (i = 0; i < n; i++) {
scanf("%s%d%d", stu[i].name, &stu[i].years, &stu[i].score);
stu[i].years++;
stu[i].score *= 1.2;
if (stu[i].score >= 600) stu[i].score = 600;
}
for (i = 0; i < n; i++) {
printf("%s %d %d\n", stu[i].name, stu[i].years, stu[i].score);
}
return 0;
}
好像是访问越界的问题
把name改成数组就AC了
但是为什么指针不能用,搞不明白
求大佬解惑