16,467
社区成员
发帖
与我相关
我的任务
分享
#include <iostream>
using namespace std;
struct HJ{
int day;
int month;
int year;
};
void fun1(HJ (&hj)[3][4]);
void fun2(HJ (&hj)[3][4]);
void fun3(HJ (&hj)[3][4]);
int main(){
HJ hj1[3][4];
for(int i=0;i <3;i++)
for(int j=0;j <4;j++)
{
hj1[i][j].day=1;
hj1[i][j].month=i+1;
hj1[i][j].year=j;
}
fun1(hj1);
system("pause");
return 0;
}
void fun1(HJ (&hj)[3][4])//error C2234: ' <Unknown>' : arrays of references are illegal
{ //error C2447: missing function header (old-style formal list?)
cout <<"hj" <<endl;
cout <<hj[0][1].day <<endl;
}
void fun3(HJ (&hj)[3][4])
{
cout <<"hj" <<endl;
cout <<hj[0][1].day <<endl;
}
void fun2(HJ (&hj)[3][4])
{
cout <<"hj" <<endl;
cout <<hj[0][1].day <<endl;
}