T
Thorsan
im doing the following:
int _tmain(int argc, _TCHAR* argv[])
{
typedef double matrix4x4[4][4];
matrix4x4 *mat = (matrix4x4*)malloc(sizeof(matrix4x4));
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
if(i==j) *mat[j] = 1;
else *mat[j] = 0;
}
//printf("\n");
}
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
printf("%f ", *mat[j]);
}
printf("\n");
}
return 0;
}
and it does not work. it works on another computer but not mine.
but if i put in the printf("\n") that i have comented out, it works just fine.
why? I get acess vioalation. The debugger shows something like this:
*mat ..... double[4][4]
*mat .... double[4]
*mat[j] double
....
mat double[4][4]*
mat double[4][4] //this does not seem correct
mat[j] double[4] //this does not seem correct
can anyone help me?
thor andreas
int _tmain(int argc, _TCHAR* argv[])
{
typedef double matrix4x4[4][4];
matrix4x4 *mat = (matrix4x4*)malloc(sizeof(matrix4x4));
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
if(i==j) *mat[j] = 1;
else *mat[j] = 0;
}
//printf("\n");
}
for(int i=0;i<4;i++)
{
for(int j=0;j<4;j++)
{
printf("%f ", *mat[j]);
}
printf("\n");
}
return 0;
}
and it does not work. it works on another computer but not mine.
but if i put in the printf("\n") that i have comented out, it works just fine.
why? I get acess vioalation. The debugger shows something like this:
*mat ..... double[4][4]
*mat .... double[4]
*mat[j] double
....
mat double[4][4]*
mat double[4][4] //this does not seem correct
mat[j] double[4] //this does not seem correct
can anyone help me?
thor andreas