index [ x ] is going to store index of character ' x ' in str . If x is not present or x is more than once , then it is going to store a value ( for example , length of string ) that cannot be a valid index in str [ ]
int index [ MAX_CHAR ] ;