Program halts for no apparent reason

Hi,

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.

1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
typedef struct element {short int 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 short int 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.
Last edited on
*m[i][j] should be (*m)[i][j].
Yep, it works now. Thanks a bunch!
Topic archived. No new replies allowed.