大家帮忙看看结构体内整型数组scanf赋值错误问题
这是代码的前部分:int main()
{
struct Student stu[3] = { { 11, 10001, "Zhang", 99.5, 88.5, 89.5 }, { 12, 10002, "Yang", 77.9, 56.5, 87.5 }, { 11, 10003, "Liang", 92.5, 99.0, 60.5 } };
struct Student temp;
const int n = 3;
int j, k, i;
struct Student stu1;
for (i = 0; i < n - 1; i++)
{
k = i;
for (j = i + 1; j < n; j++)
if (stu[j].banji < stu[k].banji)
{
k = j;
temp = stu[k];
stu[k] = stu[i];
stu[i] = temp;
}
}
scanf("%d %d %s %f %f %f", &stu1.id, &stu1.banji, stu1.name, &stu1.score[0], &stu1.score[1], &stu1.score[2]);
输入10001 11 Zhang 55.0 56.0 57.0后stu1的score部分赋值错误:
- score 0x0084f9f8 {-9.2559604829362779e+061, -9.2559604832355934e+061, -9.2559604835349090e+061} double[3]
这是什么原因,初学者请多指教