65.9K
CodeProject is changing. Read more.
Home

Swaping values of two variable without temporary variable

starIconstarIconstarIconemptyStarIconemptyStarIcon

3.00/5 (2 votes)

Mar 17, 2010

CPOL
viewsIcon

6321

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);