Can anyone tell me what is wrong with this code?
#include <iostream>
#define MATRIX_DIMENSION 4


int main(int nArgs, char** pArgs)
{
int nDim = MATRIX_DIMENSION;
double fMatr[MATRIX_DIMENSION*MATRIX_DIMENSION] =
{
1.0, 2.0, -1.0, -2.0,
1.0, 3.0, -1.0, -2.0,
2.0, 1.0, 1.0, 1.0,
3.0, 1.0, 2.0, 1.0,
};
double fVec[MATRIX_DIMENSION] = {-6.0, -4.0, 11.0, 15.0};

double fSolution[MATRIX_DIMENSION];
int res;
int i;

res = LinearEquationsSolving(nDim, fMatr, fVec, fSolution); // !!!

if(res)
{
printf("No solution!\n");
return 1;
}
else
{
printf("Solution:\n");
VectorPrint(nDim, fSolution);

}


return 0;
}

1) you don't use code tags.
2) You tell me.

What type of array to you think fMatr is? Or putting it another way, is fMatr declared as a single dimensional array or a two dimensional array?

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.