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
1904

... Contents 1904 Centuries: 19th century - 20th century - 21st century Decades: 1850s 1860s 1870s 1880s 1890s - 1900s - 1910s 1920s 1930s 1940s 1950s Years: ...

 
 
 
This page was created in 46.9 ms