:: Re: [DNG] [OT] [Re: Studying C as t…
トップ ページ
このメッセージを削除
このメッセージに返信
著者: Steve Litt
日付:  
To: dng
題目: 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