Click here to Skip to main content
Click here to Skip to main content
Alternative Tip/Trick

Tagged as

Swaping values of two variable without temporary variable

, 17 Mar 2010 CPOL
Rate this:
Please Sign up or sign in to vote.
There is also InterlockedExchange (or your operating system's equivalent).long a = 1;long b = 2;b = InterlockedExchange(&a, b);
There is also InterlockedExchange (or your operating system's equivalent).
 
long a = 1;
long b = 2;
b = InterlockedExchange(&a, b);

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

Share

About the Author

WebBiscuit
Software Developer Web Biscuit
United Kingdom United Kingdom
At Web Biscuit, you can find software, articles, a good dollop of quality and an unhealthy obsession over biscuits.
Website: http://www.webbiscuit.co.uk
Twitter Watch: http://twitter.com/WebBiscuitCoUk

Comments and Discussions

 
-- There are no messages in this forum --
| Advertise | Privacy | Terms of Use | Mobile
Web03 | 2.8.141223.1 | Last Updated 17 Mar 2010
Article Copyright 2010 by WebBiscuit
Everything else Copyright © CodeProject, 1999-2014
Layout: fixed | fluid