Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Your call to the function <code>berakna_histogram_abs</code> is wrong in <code>main()</code>, it should be :</p> <pre><code>berakna_histogram_abs(histogram, textRad); // ^ </code></pre> <p>The <code>[]</code> are in the function declaration to indicated that it takes an array, you don't have to use it for the function call.</p> <p>You have another error :</p> <p>The prototype of the function <code>berakna_histogram_abs</code> is :</p> <pre><code>void berakna_histogram_abs(int histogram[], int antal); // ^^^ </code></pre> <p>before you <code>main()</code> definition and </p> <pre><code>void berakna_histogram_abs(int tal[], string textRad){...} // ^^^^^^ </code></pre> <p>Also in your main you are trying to pass a string as argument, so your code should be :</p> <pre><code>void berakna_histogram_abs(int histogram[], string antal); int main() { // ... } void berakna_histogram_abs(int tal[], string textRad){ //.... } </code></pre> <p>And last thing : try to pass reference or <code>const</code> reference instead of value :</p> <pre><code>void berakna_histogram_abs(int tal[], string&amp; textRad) // ^ </code></pre> <hr> <p>You final code should look like :</p> <pre><code>const int ANTAL_BOKSTAVER = 26; //A-Z void berakna_histogram_abs(int histogram[], const string&amp; antal); int main() { string textRad = ""; int histogram[ANTAL_BOKSTAVER]; getline(cin, textRad); berakna_histogram_abs(histogram, textRad); return 0; } void berakna_histogram_abs(int tal[], const string&amp; textRad) { int antal = textRad.length(); for(int i = 0; i &lt; antal; i++){ if(textRad.at(i) == 'a' || textRad.at(i) == 'A'){ tal[0] + 1; } } } </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload