can anyone explain what is happening in this program I really dont understand it. thank you.
Code:
#include <stdio.h>
int main() {
int index, freq[26], c, stars, maxfreq;
for (index=0; index<26; index++)
freq[index] = 0;
while ( (c = getchar()) !=EOF) {
if (isalpha(c))
freq[2*(tolower(c)-'a')]++;
}
maxfreq = freq[0];
for (index = 1; index < 26; index++) {
if (freq[index] > maxfreq)
maxfreq = freq[index];
}
for (index=maxfreq; index>=1; index--) {
for (stars=0; stars<26; stars++) {
if (freq[stars] >= index)
printf("*");
else
printf(" ");
}
printf("\n");
}
printf("abcdefghijklmnopqrstuvwxyz\n");
system("pause");
return 0;
}