Originally Posted by
Enanito01478
Hello,
I received an assignment from my software engineering course that requires me to update and work on a program that's been in the works since the very late 90's. I decided to compile the project to see if there were any errors; sure enough, I got a mess of them. I have been able to iron out some of the errors, but there is an issue with multidimensional arrays in the prototypes of these functions in a header file.
Here's an example of some of the functions in this header file:
Code:
int MatrixMultChecker(double [][], int , int ,
double [][], int , int ,
double [][], int , int );
void MatrixMultCorrector(double [][], int, int,
double [][], int, int,
double [][], int, int);
int CompareMatrices(double [][], int, int,
double [][], int, int);
For each instance of a multidimensional array, the compiler spits out the following error:
Code:
./include/matrix.h:7: error: array type has incomplete element type
I've been checking resource sites for C (normally I program in C++, but this is a very old project), but everything I find seems to line up with the format for multidimensional arrays. Does anyone see something obvious here that I'm just not getting?
so
Code:
int MatrixMultChecker(double [][], int , int ,
double [][], int , int ,
double [][], int , int );
void MatrixMultCorrector(double [][], int, int,
double [][], int, int,
double [][], int, int);
int CompareMatrices(double [][], int, int,
double [][], int, int);
contains an unbounded array times. In other words, the compiler can't determine what size to expect. The general rule for passing arrays as parameters is that either specify all dimensions or only leave the leftmost dimension unbounded. All other dimensions have to be defined. Thus, you can have either
Code:
int MatrixMultChecker(double [size1][size2], int , int ,
double [size3][size4], int , int ,
double [size5][size6], int , int );
.......
or
Code:
int MatrixMultChecker(double [][size2], int , int ,
double [][size4], int , int ,
double [][size6], int , int );
.......