My code can't handle large data, counting letters from my redirected input. End result is hanging and giving enormous numbers. The size of file shouldn't matter as it reads the character, counts it, and moves on. So I'm stumped. count[26]
holds the number of each letter, where do I have control over the limit of these numbers?
int main (int argc, char *argv[])
{
int count [26] = { };
char c;
c = cin.get();
while(!cin.eof())
{
if (isalpha(c))
{
c = tolower(c);
count [ c - 'a']++;
}
c = cin.get();
}
} //end main