title: Passing a 2d vector to a function
body: <p>I have a 2d vector of integers :</p>
  
  <pre><code>std::vector&lt;std::vector&lt;int&gt; &gt; matrix;
  </code></pre>
  
  <p>And I want to call a function on this object.
  The function is :</p>
  
  <pre><code>int coverTransactions(int k, const std::vector&lt;std::vector&lt;int&gt; &gt; matrix ) { //k nombre de clusters
      int compteur = 0;
      for(int t = 0; t != 11; t++) {
          compteur = 0;
          for(int i = 0; i != k; i++) {
              if(matrix[t][i] == 1)
                  compteur++;
          }
          if(compteur != 1)
              return -1; //on retourne -1 si la transaction n'appartient pas à un et un seul cluster
      }
      return 0;//si tout se passe correctement, cad t appartient à un et un seul cluster on retourne 0
  }
  </code></pre>
  
  <p>Don't pay attention to the French comments, it's just to explain how returning values are linked to the problem I want to solve but it doesn't affect the understanding of the code ...</p>
  
  <p>For some reason, when calling the function this way :</p>
  
  <pre><code>std::cout &lt;&lt; coverTransactions(3, &amp;matrix) &lt;&lt; std::endl;
  </code></pre>
  
  <p>I get the following error :</p>
  
  <pre><code> coderror: cannot convert ‘std::vector&lt;std::vector&lt;int&gt; &gt;*’ to ‘int (*)[3]’ for argument ‘2’ to ‘int coverTransactions(int, int (*)[3])’
  </code></pre>
  
  <p>I don't understand why because they are the same type ...</p>