0
Is their any way to add two numbers without using '+' operator or operator overloading?
Is this possible by embedding assembly code into our code?
1 Antwort
+ 6
You can use bitwise addition:
int add(int x, int y) {
while(y != 0) {
int c = (x & y);
x = x ^ y;
y = c << 1;
}
return x;
}