InputString : "I am unwell" "We need to go to the doctor" "How long will it take?".
OutputString: I am unwell We need to go to the doctor How long will it take?
该字符串需要清除所有出现的char ".我可以想到以下的认可
"重复步骤1和2,直到strchr()返回NULL指针.
我觉得这是解决这个问题的非常低效的方法.我需要知道,如果还有其他方法可以实现这一目标吗?伪代码或实际代码都将受到赞赏.
我需要一个函数来)从字符串的末尾删除字符.例如,hello,world)应该转换为hello,world.
我写了这个:
char *a="hello,world)";
int a_len=strlen(a);
*(a+a_len-1)='\0';
printf("%s", a);
Run Code Online (Sandbox Code Playgroud)
但输出中没有显示任何内容.