Re: String reversing problem
Keith Thompson wrote:[color=blue]
> "tmp123" <tmp123@menta.n et> writes:
> [...][color=green]
> > void revstring ( char *s )
> > {
> > char *e;
> > for( e=s+strlen(s); s!=e-- && s!=e; *s^=*e^=*s++^=* e);
> > }[/color]
>
> Undefined behavior.
>[/color]
Could be... but, could you prove your statement?
Keith Thompson wrote:[color=blue]
> "tmp123" <tmp123@menta.n et> writes:
> [...][color=green]
> > void revstring ( char *s )
> > {
> > char *e;
> > for( e=s+strlen(s); s!=e-- && s!=e; *s^=*e^=*s++^=* e);
> > }[/color]
>
> Undefined behavior.
>[/color]
Could be... but, could you prove your statement?
Comment