#include<stdioh>
#include<stringh>
#include<stdlibh>
#define SPACE
main()
{
char string[] *blank *start;
int length c = d = ;
printf(Enter a string\n);
gets(string);
length = strlen(string);
blank = string;
start = (char*)malloc(length+);
if ( start == NULL )
exit(EXIT_FAILURE);
while(*(blank+c))
{
if ( *(blank+c) == SPACE && *(blank+c+) == SPACE )
{}
else
{
*(start+d) = *(blank+c);
d++;
}
c++;
}
*(start+d)=\;
printf(%s\n start);
free(start);
return ;
From:http://tw.wingwit.com/Article/program/sjjg/201405/30742.html