//Write a function that substitutes all the occurrences of the”from” character with the “to” character in str. Make sure usingonly pointers. (C language)
char* substitute(char *str, char from, char to)
Answer
char *substitute(char *str, char from, char to) { char *ptr = str; while (*ptr) { if (*ptr == from) { *ptr = to; } ptr++; }
OR
OR