Please help me find the error in this basic c program. I am a beginner. The program counts the number of letters in each word, then should display the frequency of each letter word being repeated. Thanks in advance.
#include <stdio.h>
int main()
{ int lenCount[20], i, c, state;
for(i=0; i<=20; i++)
lenCount[i]=0;
printf("Enter the words:\n");
while((c=getchar()!=EOF)) {
if(c=='\n'||c==' '||c=='\t'){
lenCount[i] = lenCount[i] +1;
i = 0;
}
else {
++i;
}
}
for(i=0; i<=20; i++){
printf("\n Words with %d letters are repeated %d times", i, lenCount[i]);}
return 0;
}