C语言—去掉字符串空格
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<string.h>
#include<stdlib.h>
#include<math.h>
#include<time.h>
void del_space (char* ch1,char* ch2)
{
while (*ch1)
{
if (*ch1 != ' ')
{
*ch2 = *ch1;
ch2++;
}
ch1++;
}
printf ("%s", ch2);
}
int main (void)
{
char ch1 [] =" he l l o w o r l d ";
char ch2 [100] ="";
del_space (ch1,ch2);
system ("pause");
return EXIT_SUCCESS;
}
求大神指教啊 哪里不对0.0