字符串数组中查找字符串
void remove(char* str, char *substr) int l = strlen(substr); char* s = str; int i; while (*s) { if (memcmp(s, substr, l) == 0) { memset(s, 0, l); s += l; } else { s++; } } i = s - str; s = str; while (i) { *s = *str; if (*str != 0) s++; str++; i--; } *s = 0; char a[] = "adabcddabcdd"; char b[] = "abc"; remove(a, b); printf("%s", a); getch(); return 0;
{
}
int main()
{
}
关键词: 字符串数组字符

加入微信
获取电子行业最新资讯
搜索微信公众号:EEPW
或用微信扫描左侧二维码