title: transform matrix 2D to 1D
body: <p>I have an issue passing a matrix 2D to a vector(1D array)with function in C. There is the code of what  i want to create:</p>
  
  <pre><code>#include &lt;stdio.h&gt;
  #define N  64
  #define A  8
  
  
  int tab2[A][A];
  int vect[N];
  void fonc(int i,int j,int k,int l,int c,int **tab2,int *vect);
  
  void fonc(int i,int j,int k,int l,int c,int **tab2,int *vect){
  
  vect[k]=tab2[0][0];
  printf("%d",vect[k]);
    while(i!=8 &amp;&amp; j!=8)
      {
          //bas
          i=i;
      j=j+1;
  
  
      vect[k]++;
        printf("%d\t",vect[k]);
      //descente
      while(j !=0)
      {
       i=i+1;
       j=j-1;
  
       vect[k]++;
      }
  
      //droite
      i=i;
      j=j+1;
  
      vect[k]++;
       //montée
      while(i !=0)
      {
       i=i-1;
       j=j+1;
  
       vect[k]++;
      }
      }
  
  }
  
  
  
  int main (){
      int vect[64] ;
  int tab2[8][8]={
  {1, 2, 6, 7, 15, 16 ,28 ,1},
  {3, 5, 8, 14, 17 ,27 ,29 ,1},
  {4, 9, 13, 18, 26, 30, 39 ,1},
  {10, 12, 19, 25, 31 ,38 ,40 ,1},
  {11, 20 ,24, 32 ,37 ,41 ,46 ,1} ,
  {21 ,23, 33, 36, 42, 45, 47 ,1},
  {22, 34 ,35, 43, 44, 48, 49 ,1},
  {22, 34 ,35, 43, 44, 48, 49 ,1}};
      int i;
      int j;
      int k;
  
  fonc(i,j,k,8,8,tab2,vect);
  //printf("%d\n", ) ;//limpide !
  return 0;
  }
  </code></pre>
  
  <p>i don't have errors but it debug i can't the result somoene have an idea how can i do , i use the function to applied a zigzag linear transform for jpeg compression RLE codingthank you for all
   i try to do this :
  <img src="https://i.stack.imgur.com/Frabh.jpg" alt="enter image description here"></p>
  
  <pre><code>0, 0
  0, 1    1, 0
  2, 0    1, 1    0, 2
  0, 3    1, 2    2, 1    3, 0
  4, 0    3, 1    2, 2    1, 3    0, 4
  0, 5    1, 4    2, 3    3, 2    4, 1    5, 0
  6, 0    5, 1    4, 2    3, 3    2, 4    1, 5    0, 6
  0, 7    1, 6    2, 5    3, 4    4, 3    5, 2    6, 1    7, 0
  7, 1    6, 2    5, 3    4, 4    3, 5    2, 6    1, 7
  2, 7    3, 6    4, 5    5, 4    6, 3    7, 2
  </code></pre>