#ifndef SWAP
#define SWAP(a, b) do { (a) ^= (b); (b) ^= (a); (a) ^= (b); } while (0)
#endif
通过三次异或实现了两个变量值的交换,实际编程中避免使用了过多的存储空间来存储中间变量。
#ifndef SWAP
#define SWAP(a, b) do { (a) ^= (b); (b) ^= (a); (a) ^= (b); } while (0)
#endif
通过三次异或实现了两个变量值的交换,实际编程中避免使用了过多的存储空间来存储中间变量。