title: strcmp inside if does not work inside function
body: <p>I am writing a function which receives several arrays as arguments, as follows:</p>
  
  <pre class="lang-cpp prettyprint-override"><code>const int numofparticles = 20;
  const int numofdims = 46;
  const int numforn = 222;
  const int forn_sem_repet = 92;
  
  float cost(float x[numofdims], float M[numofdims][numforn], char prod[numofdims][102], char forn_list[numforn][102], float qtde[numofdims][1], float min_prices[forn_sem_repet], char min_forn[forn_sem_repet][102]){
      float v = 0;
      vector&lt;string&gt; forn;
      vector&lt;float&gt; total;
      int i;
      int j;
      for(i=0;i&lt;numofdims;i++){
          if(x[i] != -1){
              forn.push_back(forn_list[(int)x[i]]);
              total.push_back(qtde[i][1] * M[i][(int)x[i]]);
              for(j=i+1;j&lt;numofdims;j++){
                  if(strcmp(forn_list[(int)x[j]],forn.back()) == 0){
                      total.back() += qtde[j][1] * M[j][(int)x[j]];
                      x[j] = -1;
                  }
              }
          }
          else{
              continue;
          }
      }
      for(i=0;i&lt;numofdims;i++){
          v += qtde[i][1] * M[i][(int)x[i]];
      }
      int lin;
      for(i=0;i&lt;forn.size();i++){
          for(int ii=0;ii&lt;forn_sem_repet;ii++){
              if(strcmp(forn[i],min_forn[lin]) == 0){
                  lin = ii;
                  break;
              }
          }
          if(total[i] &lt; min_prices[lin]){
              v += 1000;
          }
      }
  
      return v;
   }
  
  </code></pre>
  
  <p>And it returns an error in both <code>strcmp()</code>.</p>
  
  <pre><code>error: cannot convert ‘__gnu_cxx::__alloc_traits&lt;std::allocator&lt;std::__cxx11::basic_string&lt;char&gt; &gt; &gt;::value_type {aka std::__cxx11::basic_string&lt;char&gt;}’ to ‘const char*’ for argument ‘2’ to ‘int strcmp(const char*, const char*)’
                   if(strcmp(forn_list[(int)x[j]],forn.back()) == 0){
  </code></pre>
  
  <p>and</p>
  
  <pre><code>error: cannot convert ‘__gnu_cxx::__alloc_traits&lt;std::allocator&lt;std::__cxx11::basic_string&lt;char&gt; &gt; &gt;::value_type {aka std::__cxx11::basic_string&lt;char&gt;}’ to ‘const char*’ for argument ‘1’ to ‘int strcmp(const char*, const char*)’
               if(strcmp(forn[i],min_forn[lin]) == 0){
  </code></pre>
  
  <p>However, in the <code>main</code> function, after loading all the variables, the loop.</p>
  
  <pre class="lang-cpp prettyprint-override"><code>for(i=0;i&lt;numforn;i++){
              for(j=0;j&lt;forn_sem_repet;j++){
                  if(strcmp(forn_list[i],min_forn[j]) == 0){
                      printf("%s\n%s  %d  %d", forn_list[i],min_forn[j],i,j);
                      printf("\n\n");
                      break;
                  }
  
              }
          }
  </code></pre>
  
  <p>Works exactly as expected.</p>
  
  <p>What can be done to solve this problem in the function <code>cost</code>?</p>