Im working on a program for a course, where the program needs to read a single line of a user input and count how many of each letter is in the line. the amount of each letter is put in an array. For example, if the user inputs "Apple" the program should put 1 a, 2 ps, 1 l, and 1 e into the counting array. My problem is that my professor says I cannot use strings in the program.I am unsure of how to store multiple characters so that scanf can read them without using a string. When asking for help, he said to read the input one character at a time.
Ive tried to using scanf within a do-while loop to read each character of the input, but most of my attempts have just ended up with only the first character being read and put into the array which records the number of letters.
printf("ENTER A LINE OF TEXT: \n");
do {
scanf("%c ", &userChar);
userChar = toupper(userChar);
userCharVal = userChar;
histo[userCharVal - 65] = histo[userCharVal - 65] + 1;
} while(userChar == '\n');
if the user enters "apple", the corresponding array histo[] will be updated based on which letter was typed. i. e. if the user entered apple, the program will first add 1 to histo[0] (corresponding to 'a') and then read the next character of the word. It should end reading the user input at a newline. In reality, the program just records the first character and then ends.