You people are making a mountain out of a molehill.
int main()
{
char arr[] = {'a', 'b', 'c', ' ', ' ', ' ', ' ', ' ', 'd', 'e', 'f', '\0'};
char *p1, *p2;
p1 = strchr(arr,' '); // find 1st space
p2 = strrchr(arr,' '); // find last space
if(p1 && p2)
memmove(p1,p2+1,strlen(p2)+1); // remove all spaces
cout << arr << "\n";
}