From this Web site
http://www.programmingsimplified.com/c-program-find-characters-frequency
They have an example that will count a – z but not A-Z or spaces or standard punctuations.
while ( string[c] != '\0' )
{
/* Considering characters from 'a' to 'z' only */
if ( string[c] >= 'a' && string[c] <= 'z' )
count[string[c]-'a']++;
c++;
}
for ( c = 0 ; c < 26 ; c++ )
{
if( count[c] != 0 )
To count all characters in the string use an
int a[256]and use the characters of the string as indexes into the array and increment: