in reply to Re^7: How do I reverse the order of the first and last word of a string?
in thread How do I reverse the order of the first and last word of a string?

Anyway, your code could be reduced by one line
b = b + a ; a = b - a ; b = b - a ;

Actually, I absolutely can't remember what my "original" code was really like. I "reconstructed" it this morning but didn't put much thought in it: just wanted to stick with with a scheme like that of the XOR trick, with the same operation on all (first three) lines. Of course, since XOR is again both plus and minus in Z_2, then the above code is equivalent to it too.

  • Comment on Re^8: How do I reverse the order of the first and last word of a string?
  • Download Code