this is a very interesting algorithm :)) this port of your code dont have any problem !! you must have array[26] of one data struct or class and indexing with tolower(ch) - 'a' :)) this is too interesting :D i really like it :D first time see such as. when indexing the array then ++ the one member of struct "frequency"
You are iterating through a string. Lets say the string is "An."
First 'A' is found. tolower('A') returns 'a'. Then you subtract 'a' from it (which makes sense, because characters are their ascii codes. 'a' == 97, I think ) and get a 0. Then you find the 0th element of frequencyArray and increment one of it's members.
Then you find 'n'. tolower('n') returns 'n'. 'n'-'a' = 13 (I think). Then the 13th element of frequencyArray is found and incremented.
Finaly a '.' is found and the loop terminates.