A C++ program written by me refuses to work, halting and leaving no error message. I'm not that knowledgeable about possible behavior of some structures I used, so it may need optimization, I just don't know where.
typedefstruct element {shortint a, b, c;} element;
typedef element matrix[64][64];
void regen (matrix *m, int size)
{
matrix n;
for (int i=0; i<size; i++)
for (int j=0; j<size; j++)
{
n[2*i][2*j].a=(*m[i][j]).b;
... and similar assignments for other elements ...
}
for (int i=0; i<2*size; i++)
for (int j=0; j<2*size; j++)
*m[i][j]=n[i][j];
}
(So it just transforms a matrix into one with a larger size)
void output (matrix m, int size)
{
for (int i=0; i<size; i++)
{
for (int j=0; j<size; j++)
cout << m[i][j].a+m[i][j].b+m[i][j].c << "";
cout << "\n";
}
}
(Outputing the items)
int main(int argc, char *argv[])
{
matrix m_main;
...Here I assign shortint values to the elements...
regen (&m_main, 2);
output (m_main, 6);
system("PAUSE");
return EXIT_SUCCESS;
}
;
If the answer isn't clear without the complete code, I can post it right here.