#include <iostream>
using namespace std;
int main()
{
char c[]= "this is a test character string";
char *p = c;
char *t = NULL;
while(*p != '\0')
{
if (*p == ' ')
{
//空格以后的所有字符串前移一个位置
t = p;
while(*t != '\0')
{
*t = *(t+1);
t++;
}
}
p++;
}
p = c;
while(*p != '\0')
{
cout << *p++;
}
cout << endl;
return 0;
}
追问while(*p != '\0')
{
cout << *p++;
}
cout << endl;
这里好像有点问题,cout没有说明。。。我有点看不懂