struct MAT22
{
unsigned char M[2][2]; //It wont work save with chars Why ?
};
//This routine works fairly well.
int det22(MAT22 mat22)
{
char ret, temp, temp2;
temp = mat22.M[1][1] * mat22.M[2][2];
temp2 = mat22.M[1][2] * mat22.M[2][1];
ret = temp - temp2;
return ret;
}
void main()
{
MAT22 mat22;
//This is strange. Only mat22.M[1][1] gets assigned
//The other assigning code is dysfunctional and stays at the original garbage values. Again, why ?
mat22.M[1][1] = 8;
mat22.M[1][2] = 7;
mat22.M[2][1] = 2;
mat22.M[2][2] = 1;
// cout << det22(mat22);
}
I`ve spent time in the debugger and heres what I`ve found.
Using any other kind of data than a char or variant I come up with a access violation in the exit program routines.
I have no CLUE why the assigning code is dysfunctional, it shos up in the debugger.
Thanx,
~V''lion
I came, I saw, I got programmers block.
~V''''lion
Things aint workin out.
OK.
I`ve run into some peculiar probs with this program
I`m trying to create a program that pulls the determinant of ut of a 2x2 matrix. Simple, yes ?
I have commented the probs.
~V'lionBugle4d
This topic is closed to new replies.
Advertisement
Popular Topics
Advertisement
Recommended Tutorials
Advertisement