hi, i'm trying to search for a character in a string array (see code below), but i'm stuck on how to display the character (if found in the string) at its correct position.
for example, if letter='a' and orgWord="orange", it should display _ _ a _ _ _ .
Thanks a lot.
int MatchLetter(char* letter, char* orgWord) {
char wordStr[50];
int i;
char *pdest;
pdest = strchr( orgWord, letter );
for (i=0; i<=strlen(orgWord); i++) {
if (pdest!=NULL) { //letter found in string
wordStr[i]=letter;
printf(wordStr[i]);
return 0;
}else{
wordStr[i]='_';
printf('_');
return 1;
} //end if
} //end else
} //end function