C
c
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
#include <stdio.h>
#include <stdlib.h>
#include <string.h>
void replaceAll(char *, const char*);
int main()
{
char hey[] = "hello mf im god here punk";
const char *nee = "god";
replaceAll(hey, nee);
printf("\n");
printf("%s\n", hey); // Print the modified string directly
return 0;
}
void replaceAll(char *str, const char *old)
{
char *pos = strstr(str, old);
if (pos != NULL)
{
strcpy(pos, pos + strlen(old)); // Replace 'old' with the string after it
}
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run