Encyclopedia > Xor swap algorithm Visual basic code

  Article Content

Xor swap algorithm/Visual basic code

The following Visual Basic subroutine swaps the values of its parameters using the xor operator.

 Sub Swap (Var1, Var2)
    Var1 = Var1 Xor Var2
    Var2 = Var2 Xor Var1
    Var1 = Var1 Xor Var2
 End Sub

See: Xor swap algorithm



All Wikipedia text is available under the terms of the GNU Free Documentation License

 
  Search Encyclopedia

Search over one million articles, find something about almost anything!
 
 
  
  Featured Article
North Haven, New York

... median income for a household in the village is $74,583, and the median income for a family is $81,363. Males have a median income of $51,319 versus $41,875 for ...

 
 
 
This page was created in 32.6 ms