Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Write a function countFrequency(char sentence, int \"letterFrequency) to count h

ID: 3904367 • Letter: W

Question

Write a function countFrequency(char sentence, int "letterFrequency) to count how many times each of the 26 letters is used in a sentence passed as the first argument to the function and return the number of times each letter is used in the array letterFrequency also passed as an argument. The following main program illustrates how your function will be called. Assume all letters in the sentence are capital letters. The asci equivalent for capital A is 0x41, B is 0x42 and so on. Write the function in C 10 Points. Translate it into assembly 15 points. Int main() char sentencel 1024?HERE IS A SENTENCE DO AS YOU wiSH MORE AND MORE IF YOU LIKE TO STAY IN THIS CLASS" int letterFreq[26]; int i; for "int( i-o ;i

Explanation / Answer

void countFrequency(char *sentence, int *letterFrequency) {
   char ch;
   int i = 0;
   while((ch = sentence[i])) {
       letterFrequency[ch-'A']++;
       i++;
   }
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote