Could someone look at this code and tell me what I'm doing wrong? I'm sure it's something simple...I just can't stare at it any longer. I'm using a function to count the number of vowels in a string input by the user. When I print the results, I get zero.
int numvowels (char line[], int length)
{ int b, count = 0;
for (b = 0; b <= length; b++)
{ if (line[b] == 'A')
count++;
if (line[b] == 'E')
count++;
if (line[b] == 'I')
count++;
if (line[b] == 'O')
count++;
if (line[b] == 'U')
count++;
if (line[b] == 'Y')
count++;
}
return count;
}
Thanks!