How to get frequency of a character in range where char frequency is stored in prefix array

I have a string consisting of only lower case alphabets. I have a character c. I want to calculate the frequency of c in a range. Can this be solved by making prefix frequency array.

For example : string : abccdaebca, and character c = ‘c’
The prefix array would be

0 0 1 2 2 2 2 2 2 3 3

Now I want to calculate frequency of c for range. I am not able to deduce how to do it. Please help.