传递二维数组,仿野比兄方法写的代码,有错误,可能我水平太菜。代码有不妥处,请指出,谢谢!!!
/********************************************************
** Highlight software by yzfy(雨中飞燕) http://yzfy.org *
*********************************************************/
#include<iostream>
using namespace std;
int main()
{
int row=5,column=5;
int func(int * a, int row, int column);
int a[][]=new int[column][row];
for(int i=0;i<row;i++)
for(int j=0;j<column;j++)
a[i][j]=i+j;
func(*a,row,column);
system("pause");
return 0;
}
int fun(int *a,int row,int column)
{
for(int i=0; i<=row;i++)
for(int j=0;j<=column;j++)
cout<<a[row][column]<<" ";
}
其中int a[][]=new int[column][row]这一句提示:
cannot convert from 'int (*)[1]' to 'int [][1]',