Skip to content

Instantly share code, notes, and snippets.

@Yangff
Created June 21, 2017 19:44
Show Gist options
  • Save Yangff/b81027e3fad94dbb9062da50fb90347c to your computer and use it in GitHub Desktop.
Save Yangff/b81027e3fad94dbb9062da50fb90347c to your computer and use it in GitHub Desktop.
void del_substr(char *str, const char *substr) {
char *c1, *c2;
while (*str++!=0) {
for (c1 = str, c2 = (char*)substr; *c1 == *c2 && *c1 && *c2; c1++, c2++);
if (*c2 == 0)
for (c2 = str; *c2++ = *c1++; );
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment