How to write a C Function to xorSwap and addSwap in C Programming Language ?
Solution:
- void xorSwap(unsigned int *x, unsigned int *y) {
- *x ^= *y;
- *y ^= *x;
- *x ^= *y;
- }
- void addSwap(double *x, double *y)
- {
- *x = *x + *y;
- *y = *x - *y;
- *x = *x - *y;
- }