I cannot figure out why this code doesn't work. It should replace every 's' character with a 'f' character. It manages to replace once then terminates the string directly after.
Example: "This is a test string!" becomes "Thif", when it should be "Thif if a teft ftring!".
Code:
char* chstrswithf(char* a)
{
while(*a != '\0')
{
if(*a == 's')
*a = 'f';
a++;
}
return a;
}