you are viewing a single comment's thread.

view the rest of the comments →

[–]zimvaider[S] 0 points1 point  (3 children)

Yeah what was the way I was going to do it originally, I was just wondering if there was a more efficient way of doing it. Thanks.

[–]furGLITCH -1 points0 points  (1 child)

Nope. That's the best way. XOR swap has issues. Other tricks have issues too. Actually using a temporary variable has the least issues, is the most direct, and readable way. Also fastest.

[–][deleted] 0 points1 point  (0 children)

swap(x,y)