是想在 字符串 a里找到有b的地方全部替换成c
解决方案
40
第二层while循环条件不对
int main() { char a[50] = "abcdecdffcdg"; char b[5] = "cd"; char c[5] = "dc"; char *pa = a; char *pb = b; char *pc = c; pa = strstr(pa, pb); while (pa != NULL) { while (*pc != "\0") { *pa = *pc; pa++; pc++; } pc = c; pa = strstr(pa, pb); } printf("%s\n", a); return 0; }