yes, I did recompile it :
Code:
#include <stdio.h>
#define ASCII_VALUES 256
int
main(int argc, char **argv) {
int i, ch;
int frequency[ASCII_VALUES] = {0};
printf("Enter some text to count the frequency of the characters: ");
while ((ch=getchar()) != EOF)
{
if (frequency[ch]==0)
{
frequency[ch] = 1;
}
else
{
frequency[ch] ++;
}
}
printf("Character Frequency");
for (i = 0; i < ASCII_VALUES; i++)
{
if (frequency[i] != 0 )
{
printf("%c %d\n", i, frequency[i]);
}
}
return 0;
}
for : HELLO WORLD
prints:
Code:
Enter some text to count the frequency of the characters: HELLO WORLD
Character Frequency
1
1
D 1
E 1
H 1
L 1
O 1
R 1
W 1
im not sure how to use isprint. I'm kicking myself because i had the answer worked out last night but erased the file