Monday 15 June 2015

Passing a 2-D array in pure C -


I am trying to write a normal matrix transcease function

  void reverse (int ** V, int vertexes) {for (int i = 0; i & lt; vertexes; i ++) for (int j = 0; j & lt; vertexes; j ++) {if (v [i] [J] == 1 & amp; nbsp; [J] [I] == 0] {V [J] [I] = -1; V [ii] [ja] = 0; }} For (int i = 0; i   

and the main task is

  zero metrics_graph :: process () {int v [7] [7] [7] = {{0, 0,0,0,0,0,0}, {0,1,1,0,0,0,0}, {1,0,0,0,0,0,0}, {0,0, 0, 0,1,0,0}, {0,0,0,0,0,1,0}, {0,0,0,1,0,0,1}, {0,0,0, 0, 0,1,0}}; Reverse (v, 7); }   

and I expected that

  error C2664: parameter '1' from 'reverse': 'int [7] [7]'   

Can we do anything about it?

Should we go to i , j ( v as a dimensional array )

  v [vertexes * i] [j]    

Just use

  trying to use void reverse (int vertexes   , finally [videxes] [ Vertexes]) will not work immediately with the 2-D array if you want to emphasize the  int **  interface, as described here, as an additional temporary Row-index will make the array  

or even



No comments:

Post a Comment