各为什么无符号数的加法,一方溢出一方不溢出的情况下用加法检测结果显示不溢出?
代码如下:
#include <stdio.h>
int uadd_ok(unsigned x,unsigned y){
unsigned sum = x+y;
return sum>=x;
}
int main(){
unsigned a = 12345678912;
unsigned b = 12345678912;
unsigned sum = a+b;
printf("%u\n",sum);
int func = uadd_ok(a,b);
printf("%d",func);
return 0;
}