面试题答案
一键面试#include <stdio.h>
// 定义结构体
struct student {
char name[20];
int age;
float score;
};
// 定义修改学生信息的函数
void modifyStudent(struct student *stu) {
stu->age += 1;
stu->score *= 1.2;
}
int main() {
struct student stu = {"Tom", 20, 85.5};
modifyStudent(&stu);
printf("Name: %s\n", stu.name);
printf("Age: %d\n", stu.age);
printf("Score: %.2f\n", stu.score);
return 0;
}