#include <stdio.h>
int main()
{
  int x = 10, y = 5;

  // Code to swap 'x' and 'y'

  y=x+y-(x=y);

 printf("After Swapping: x = %d, y = %d", x, y);

  return 0;
}

You're still introducing a new space in ram. Also, you're doing extra instuctions making it more inefficient if optimizations don't pick up on it (I feel like most probably wont). Not to mention it's harder to read.

It's a cute party trick I suppose.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.