change_char()
#
change_char()
replaces all occurrences of a specified character in a string with another character and returns the count of replacements.
Prototype
int change_char(
char *s, /* Input string to modify */
char old_c, /* Character to be replaced */
char new_c /* Replacement character */
);
Parameters
Key |
Type |
Description |
---|---|---|
|
|
Pointer to the input string to be modified. |
|
|
Character in the string to be replaced. |
|
|
Character to replace occurrences of |
Return Value
Returns the number of characters replaced in the string.
Notes
The function modifies the input string in place. Ensure that s
is a valid, mutable string.
Prototype
// Not applicable in JS
Prototype
# Not applicable in Python
Examples
// TODO C examples
// TODO JS examples
# TODO Python examples