I wanna pass 2D char array to function.
However, an error comes:
Cannot convert 'char(*)[50]' to 'char**' for argument '1' to 'void prac(char**)'
How can I fix the code ? Please help me.
Code:
#include <iostream>
using namespace std;
void prac(char **b)
{
for(int i=0;i<50;i++)
{
for(int j=0;j<50;j++)
{
cout << b[i][j] << " ";
}
cout << endl;
}
}
int main()
{
char a[50][50];
for(int i=0;i<50;i++)
{
for(int j=0;j<50;j++)
{
cin >> a[i][j];
}
}
prac(a); // error position
return 0;
}