How can I wwap value two variables without using third variable or +/- operator?

+2 votes

0 votes

Use bitwise XOR somethign like

```
int x = 1, y = 2;
x = x ^ y; // x now becomes 3(0011)
y = x ^ y; // y becomes 2 (0010)
x = x ^ y; // x becomes 1 (0001)
```

Or use * and / operation

```
int x = 1, y = 20;
x = x * y; // x now becomes 20
y = x / y; // y becomes 1
x = x / y; // x becomes 20
```

In case of 0 and other value your logic will fail dear

...