First time post here. I understand that you all like to have attempted code, but I just have a conceptual question. My task is to create a C program that takes in a user inputted string and counts the character frequency. I am given a skeleton file with the Count function and two arrays one for the string the other is a length of 26 and the number of each letter occurance is to be stored in that array. I also have print message function provided that in one of its cases will divide each letter by the total amount.
For the input i just want to use scanf(), and then it says that the Count function MUST use a getchar() to read one letter of the string at a time and go until ENTER or \n is pressed. If i use scanf like this: scanf("%s", stringarray) which stores each character into that string ,I assume, how do I use getchar() in all of this to get the number that each letter occurs into the other array of 26. To get those into their appropriate spots I am planning on simply subtracting 'a' from the character and then going to that location and incrementing it. IE if my first letter is b I subract a from b and then the location 1 is incremented.
Basically, I just need to take in the string put it in an array using getchar() then use it to get the counts of each letters into the other array. and the skeleton code is provided with a function that will divide for me.
Any advice and input would be appreciated.