-2

I'm trying to test a function I have created in C++ by using a testbench. The main function parameters are two 8x8 arrays:

 void multiplyArray2(int A[8][8], int B[8][8]){

In my test bench file, I have created an input array of values and an output array and am trying to input them into the function:

int dataIn[8][8];
int dataOut[8][8];

int main(){

    dataIn = {{68, 68, 67, 67, 66, 67, 67, 67},
                {69, 69, 68, 68, 67, 69, 67, 67},
                {70, 70, 71, 71, 70, 70, 70, 70},
                {72, 72, 72, 71, 72, 72, 72, 71},
                {74, 74, 73, 73, 74, 74, 74, 74},
                {75, 76, 75, 75, 76, 76, 75, 75},
                {76, 77, 77, 76, 76, 76, 76, 76},
                {79, 78, 79, 79, 78, 76, 77, 77}};


    multiplyArray2(dataIn, dataOut);

When I try to input parameters into the function in the test bench it is providing me with this error message:

enter image description here

And I have no idea why...

Harry Reid
  • 89
  • 1
  • 7
  • You may want to look into how to pass an "array" to a function, or consider using a better data type, like std::array. Also, you are missing some closing brackets, and I got different errors with initialization, before the function. Once I fixed that, the function declaration was fine, but prone to error, since the function can't know the dimensions. – Kenny Ostrom Mar 08 '19 at 19:36

1 Answers1

0
void multiplyArray2(int A[][8], int B[][8])

This should solve your problem.

Multi-dimensional arrays are not very well supported by default in C and C++. You can pass an N-dimension array only when you know N-1 dimensions at compile time.