I'm writing a function that takes a type double array[2][5] and stores the values in another double array, then print both out. I've been stuck on this for a while, here's my code, and the error is:
copy1-1.cpp:10:7: note: candidate function not viable: no known conversion from 'double' to 'double (*)[5]' for 1st argument
void funct (double A[2][5],int r,int c)
^
Code:
#include <iostream>using namespace std;
void funct(double[2][5],int,int);
int i,j,r,c;
int n = 1;
double A[2][5] = {{1.00,2.03,3.2,3,2.4},{.34,1.35,6.54,6,4.5}};
double B[2][5];
void funct (double A[2][5],int r,int c)
{
for (i=0;i<r;i++)
{
for(j=0;j<c;j++)
B[i][j] = A[i][j];
}
}
int main ()
{
funct(A[1][4],2,5);
for (i=0;i<r;i++)
{
for(j=0;j<c;j++)
cout << "A=" << A[i][j] << "\t" << "B =" << B[i][j];
}
return 0;
}
Any help appreciataed