xor question

    Date: 04/15/06 (Algorithms)    Keywords: no keywords

    Our professor teased us that there is a way, in languages that have xor operators, to switch two variables without introducting a temporary variable. I can't figure out how to do it. Can anyone here?

    And, to clarify, xor is true if either A or B is true, but not both. I'm not clear how it relates to the problem though, since I'm imagining that A and B can be any type of values...

    Thanks for any pointers. Now I'm really rather curious. :-).

    Source: http://community.livejournal.com/algorithms/75175.html

« Encryption questions.... || Cantor's... »


antivirus | apache | asp | blogging | browser | bugtracking | cms | crm | css | database | ebay | ecommerce | google | hosting | html | java | jsp | linux | microsoft | mysql | offshore | offshoring | oscommerce | php | postgresql | programming | rss | security | seo | shopping | software | spam | spyware | sql | technology | templates | tracker | virus | web | xml | yahoo | home