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
Northampton, Suffolk County, New York

... 158 households, and 121 families residing in the town. The population density is 19.9/km² (51.6/mi²). There are 205 housing units at an average density of ...

 
 
 
This page was created in 23.1 ms