问题遇到的现象和发生背景
选TDM-GCC 492 release版本
选TDM-GCC 492 Profilling版本
问题相关代码,请勿粘贴截图
#include<stdio.h>
#define N 3
struct STU
{ //定义结构体STU
int id;
float score;
};
int fun (struct STU stu[], struct STU *s){ //定义函数fun
int i;
*s=stu[0];
for (i=0;i<N;i++){
if(stu[i].score<(*s).score) *s=stu[i];
}
}
int main(){ //以下是main函数
struct STU a[N]={{201901, 80.5}, {201902, 98.2}, {201903, 84.3}};
struct STU *s;
//编写程序调用函数fun
fun(a,s);
printf("%d %f", s->id, s->score);
return 0;
}