Hi,
can anyone tell me what goes wrong in this code?;
Code:
void rowReduce(float points[3][2], float params[2])
{
float mat[3][2];
int r,c,i;
for(r=0;r<=2;r++)
{
for(c=0;c<=3;c++)
{
if(c != 3)
{
mat[c][r] = pow(points[r][0],2-c);
}
else
{
mat[c][r] = points[r][1];
}
printf("%f ",mat[c][r]);
}
printf("\n");
}
printf("\n");
for(r=0;r<=2;r++)
{
for(c=0;c<=3;c++)
{
printf("%f ",mat[c][r]);
}
printf("\n");
}
free(mat);
}
int main(int argv, char **argc)
{
float points[3][2]= {{-10.0,1.0},{0.0,0.0},{2.0,1.0}};
float params[2];
int i;
rowReduce(points,params);
return 0;
}
When you run this code, you will see two times a set of 4 by 3 floating point numbers. These two sets should be identical, by they ar not! What's going on?
Thanks in advance....