:: Re: [DNG] [OT] [Re: Studying C as t…
Startseite
Nachricht löschen
Nachricht beantworten
Autor: Steve Litt
Datum:  
To: dng
Betreff: Re: [DNG] [OT] [Re: Studying C as told. (For help)
On Tue, 21 Jun 2016 14:43:03 -0400
"Steven W. Scott" <codekraken@???> wrote:

> May as well toss in the assembler guy approach to the problem:
>
> char SpaceSquash()
> {
>           for (i = strlen(desc) - 1; i > 0; i--) {
>                if (desc[i-1] == ' ') {
>                    if (desc[i] == ' ') {
>                        strncpy(&desc[i], &desc[i+1],
> (strlen(desc)-i)); }

                         // ^^^^ Redundant char copies, doesn't it?

>                 }
>             }
>           return 0;
> }


SteveT

Steve Litt
June 2016 featured book: Troubleshooting: Why Bother?
http://www.troubleshooters.com/twb