--- In c-prog@yahoogroups.com, "johnmatthews2000" <jm5...@...> wrote:
>
> ...and you should fix the errors, such as:

Also, the design is not good, because:

1. It assumes the string doesn't start with a space.

2. If the string was "C Programming Language " (note the space before the 
closing quote), the code would attempt to access beyond the end of the string, 
after the '\0' (run-time error).

I suggest a single loop, which checks if the current character isn't a space, 
and whether it is the first character in the string or the one before it is a 
space.

Reply via email to