Swap Two Values Without Introducing a Temporary Variable

The usual way for us to swap two values in c is by introducing a intermediate variable. But actually there is way for us to complete the task wnile not adding a new varible.

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <stdlib.h>
#include <stdio.h>

int main(){
  int a, b;
  scanf("%d %d", &a, &b);
  a = b - a;
  b = b - a;
  a = b + a;

  printf("%d %d\n", a, b);
  return 0;
}