// Remove any spaces from the end of the string static void remove_trailing_spaces(char *string) { int length; //string length for (length = 0; string[length] != '\0'; length++) int i; i = length; while(string[i] != ' '){ i--; } length -= i; string[length] = '\0';