Explain working of code

Can you explain how the index of the arrays specially freq[ ] is working https://ide.codingblocks.com/s/204749

@kt62495 there are 256 ascii symbols that have their corresponding code from 0 to 255. Now when we create an freq[256] in this freq[i] is basically representation of count of the symbol with code ā€œiā€ .
In C++ each character have a ascii code as told above and they can be used as a number.
suppose ā€˜a’ has ascii code 97, when it is written freq[str[k]]++, where str[k]=ā€˜a’, translates to freq[97]++.
If this resolves your doubt mark it as resolved.