#include<stdio.h>
#include<ctype.h>
int main() {
char* start = "There are no";
char* d = start;
char* s = d;
while (s) {
char c = *s++;
if (ispunct(c) || isspace(c)) {
continue;
}
*d++ = c;
}
printf("%s\n", start);
}
我是 c/c++ 的新手,并试图了解如何操作字符串。上面的代码扫描字符串并跳过标点符号和空格并打印没有任何标点符号和空格的字符串。
当我运行它时,我得到“总线错误:10”
我究竟做错了什么?