--- In [email protected], "py2akv" <g...@...> wrote:
>
> John,
>
> You know a picture is worth a thousand words.
>
> Show us your one-loop-only code so that everyone can review/comment on it.
Oh, if you insist :-)
#include <stdio.h>
int main(void)
{
const char *s, str[] = " C Programming Language ";
int n;
for (n = 0, s = str; *s; s++)
if ((*s != ' ') && ((s == str) || (s[-1] == ' ')))
printf(" %c" + !n++, *s);
putchar('\n'); /* might not be required */
return 0;
}
The mechanism for not outputting a leading is compact rather than
comprehensible, but could be modified eg.
printf(n++ ? " %c" : "%c", *s);