Need to write a function "int add1(int val)" in C or C++ that returns val+1
without using +'s or -'s anywhere in the code.
any insight?
THX
j*****h 发帖数: 62
2
Interesting, let me give it a try!
int add1( int val) {
return (~0 ^ val) * ~0;
}
+1
【在 g*******n 的大作中提到】 : Need to write a function "int add1(int val)" in C or C++ that returns val+1 : without using +'s or -'s anywhere in the code. : any insight? : THX