询问一个关于结构体的问题
小弟刚刚学习C++做题的时候遇到个问题,还请老师指导下:
#include<iostream>
using namespace std;
struct student
{
int num;
char name[10];
float score[3];
};
void print(student stu[5]);
void input(student stu[5]);
int main()
{
student stu[5];
input(stu[5]); //这一行报错
print(stu[5]); //这一行报错
return 0;
}
报错如下:
error C2664: 'input' : cannot convert parameter 1 from 'struct student' to 'struct student []'
No user-defined-conversion operator available that can perform this conversion, or the operator cannot be called
为什么要"convert parameter 1 from 'struct student' to 'struct student []'"呢?声明的时候参数就是结构体的数组,实参给的也是结构体的数组啊?