#include <iostream>
usingnamespace std;
int numWords;
int letterCount[26]; // stores the frequency of each letter
void readAndCount (int &numWords, int letterCount[]);
// Reads a line of input. Counts the words and the number
// of occurrences of each letter.
void outputLetterCounts (int letterCount[]);
// Prints the number of occurrences of each letter that
// appears in the input line.
int main()
{
int numWords;
int letterCount[26]; // stores the frequency of each letter
cout << endl;
cout << "Enter a line of text.." << endl << endl;
readAndCount (numWords, letterCount);
cout << endl;
cout << numWords << " words" << endl;
outputLetterCounts(letterCount);
return 0;
}
void outputLetterCounts(int letterCount[])
{
for (int i = 0; i < 26; i++)
{
if (letterCount[i] > 0)
{
cout << letterCount[i] << " " << char('a' + i) << endl;
}
}
}
On line 17, you pass numwords as a reference (the '&' characted), in the prototype. But in 52 you simply pass numwords on it's own without the reference operator, that might be it.