careercup-高等难度 18.1

18.1  编写一个函数,将两个数字相加,不得使用+或其他算术运算符。

int add(int a,int b)
{
    if(b==0)
        return a;
    int sum=a^b;
    int carry=a&b)<<1;
    return add(sum,carry);
}
原文地址:https://www.cnblogs.com/wuchanming/p/4361800.html