#include<iostream>
using namespace std;
void del_space(char* str)
{
for (int i = 0, j = 0; str[i] = str[j++]; str[i] != ' ' && ++i)
cout<<str<<endl;
}
int main(void)
{
char str[] = "hello anduo nin!";
del_space(str);
cout<<str<<endl;
return 0;
}
输出:
helloanduonin!