65,197
社区成员




#include<iostream>
using namespace std;
template<typename T,int M,int N>
void Test(T (&str)[M][N])
{
for(int i=0;i<M;i++)
{
cout<<str[i]<<endl;
}
}
int main()
{
char szTmpStr[2][50] = {"hello", "world"};
Test<char,2,50>(szTmpStr);
system("pause");
}
void Test(char **str) //str是指针的指针不是数组指针,所以会出现类型不匹配错误
{}
修改为
void Test(char (*str)[50])
{} 或
void Test(char str[][50])
{}