When I give to a variable such value: e = 17|-15; , I get -15 as an answer after compiling.I can\'t understand what arithmetic c++ uses. How does it perform a
e = 17|-15;
you have to looks at how the bits work
Basically, if either number has a 1 in a particular spot, than the result will also have a 1
1
-15 : 11110001 (two's complement) 17 : 00010001 -15 | 17 : 11110001
as you can see, the result is the same as -15
-15