I have recently started using C and am having trouble understanding the use of "&" and "*" and where to put them in my code. The current assignment I have requires me to take two inputs, the character in a string that a user would like to swap and the new character to replace it with. I am not allowed to use the String library. Here is my current code but for some reason, the output is never able to access "replacementchar[0]" and I have no clue why. Any help would be appreciated. Thank you!
if(response[0] == yes[0]){
char replacechar[1];
printf("What character do you want to replace: ");
scanf("%s", replacechar);
char newchar[1];
printf("What is the replacement character: ");
scanf("%s", newchar);
printf("you want to replace %c with %c \n", replacechar[0], newchar[0]);
for(int i = len-1; i > -1; --i){
if(word[i] == replacechar[0] && word[i] != '\0'){
printf("found one\n");
word[i] = newchar[0];
}
}
}