title: Problems converting float to int in C++
body: <p>I'm trying to sum the values inside a vector by using a function that must to return a float value, like this:</p>
  
  <pre><code>float vectorSum(float *vector, int vectorSize){
      int result = 0;
  
      for (int i = 0; i &lt; vectorSize; i++){
          cout &lt;&lt; vector[i] &lt;&lt; "\n";
          resultado += vetor[i];
      }
      cout &lt;&lt; "\n\n";
  
      return resultado;
  }
  </code></pre>
  
  <p>Than I have this vars that will be filled by the user:</p>
  
  <pre><code>float vector[0];
  int vectorSize;
  
  
  cout &lt;&lt; "Write the " &lt;&lt; vectorSize &lt;&lt; " values to insert in the vector:" &lt;&lt; endl;
  
      for (int c = 0; c &lt; vectorSize; c++){
          cin &gt;&gt; vector[c];
      }
      cout &lt;&lt; "\n\n";
  </code></pre>
  
  <p>And finally will call the function vectorSum:</p>
  
  <pre><code>cout &lt;&lt; "The sum of the vector's values is:" &lt;&lt; endl;
      vectorSumTotal = vectorSum(vector, vectorSize);
      cout &lt;&lt; vectorSumTotal;
      cout &lt;&lt; "\n\n";
  </code></pre>
  
  <p>THE PROBLEM:</p>
  
  <p>If I fill the vectorSize with the value 3 and fill the vector with the values: 1, 2, 6</p>
  
  <p>Than, I don't know why, the 6 become 8.40779e-45 and I need it to keep the value 6.</p>
  
  <p>Is it a problem with conversion of float to int or maybe the pointer?</p>
  
  <p>Help?</p>