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
Jamesport, New York

... to the United States Census Bureau, the town has a total area of 20.0 km² (7.7 mi²). 11.4 km² (4.4 mi²) of it is land and 8.6 km² (3.3 mi²) of ...

 
 
 
This page was created in 36.2 ms