C Function to xorSwap and addSwap in C Programming

How to write a C Function to xorSwap and addSwap in C Programming Language ?


Solution:

  1. void xorSwap(unsigned int *x, unsigned int *y) {
  2.     *^= *y;
  3.     *^= *x;
  4.     *^= *y;
  5. }
  6. void addSwap(double *x, double *y)
  7. {
  8.     *= *+ *y;
  9.     *= *- *y;
  10.     *= *- *y;
  11. }


Learn More :