define _CRT_SECURE_NO_WARNINGS
#include
#include
#include
#include
#include
#include
#include
#include
#include
void remove_space01(char* ch)
{
char str[100] = { 0 };<br /> int i = 0;<br /> int j = 0;<br /> char* temp = str;<br /> while (ch[i] != '\0') {<br /> if (ch[i] != ' ') {<br /> str[j] = ch[i];<br /> j++;<br /> }<br /> i++;<br /> }<br /> while (*ch++ = *temp++);//还回ch<br />}
void remove_space(char ch)
{
//用来遍历字符串
char ftemp = ch;
//记录非空格字符串
char rtemp = ch;
while (ftemp)
{
if (ftemp != ‘ ‘)
{
rtemp = ftemp;
rtemp++;
}
ftemp++;
}
rtemp = 0;
}
int main()
{
char ch[] = “ h e ll o w o r lld “;
remove_space(ch);
printf(“%s\n”, ch);
return 0;<br />}