Click here to Skip to main content
12,625,447 members (36,645 online)
Click here to Skip to main content
Add your own
alternative version

Tagged as

Stats

3.3K views
1 bookmarked
Posted

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

You may also be interested in...

Pro

Comments and Discussions

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