I am trying to pass a 2D-array to a function using double pointer,however the compiler is giving the following error
[Error] cannot convert 'int (*)[3]' to 'int**' for argument '1' to 'void print1(int**, int, int)
Here is the code:
#include
using namespace std;
void print1(int **arr,int r,int c);
int main()
{
int a[2][3]={{10,20,30},{40,50,60}};
int r=2;
int c=3;
print1(a,r,c);
}
void print1(int **arr,int r,int c){
int i,j;
for(i=0;i for(j=0;j cout< }
}
}
I want to emulate two dimensional array using double pointer.
No comments:
Post a Comment