Subscripted value is neither array nor pointer ?

/*What is wrong with my code that is causing the compiler */
/*to say that the "subscripted value is neither array nor*/
/*pointer"? I believe it is referring to the variable count */
/*in the function body of display_total_count but I don't */
/*understand what I can change to make it run*/

Some syntax problems are "dressed in red", above, but I'm going to try and convince you that your program is a dress rehearsal, and a good learning experience for you.

And welcome to the forum!

But junk that program immediately (please). Before it multiplies!

Here's how you want to approach this problem of char recognition and counting:

get the string you want to count (and catalog), the chars in.

remember that each char has a number value, which the computer uses.

use the char number value as the index to the catalog[] array. The catalog array is type char, and has 126 elements in it: catalog[126].

Then use a single for or while loop, to go through the string, and for every char in the string, you increment the value of catalog[charValue]. (You will have to see that catalog[] elements are all set to zero, before you get to this loop, of course).

And now print out catalog[i] in either one or two loops, depending on how you want it displayed.

Code:

for(i='A';i<='Z';i++) {
printf("%c: %d\n",i,catalog[i]);
}

The first time through the loop, you will print out A: 3, if there are three uppercase A's in the string being processed. That will repeat for all the uppercase letters.

The above prints out the catalog array for the uppercase letters. How would you add another loop to change it so it printed out the lowercase letters?

If you use this, your program will shrink to about 15 lines of code, roughly.

These "char number values" are frequently called ASCII values or character set values. You can download an ASCII table from the net, very easily - google ASCII table to see what I'm talking about.