CodePudding user response:
Whether to write a function to replace x of a character array to y# # is for reference only
# include
# include
Void RepChar (char [] s, char x, char y)
{
for(int i=0; I
If (s==x [I])
S [I]=y;
}
}
Int main ()
{
Char STR []="xycnbyxyx";
RepChar (STR, the 'x', 'y');
Printf (" % s \ n ", STR);
}
/* run results:
Yycnbyyyy
*/