I have read many articles and SO answers to understand 2s complement
. They have helped me a lot. However, there are few doubts in my mind about 2s complement
.
1) Is 2s complement
a way to store negative numbers in order to make operation easy or have some other applications too?
2) 2s complement
is taken automatically when computer see a negative number?
3) Taking 2s complement
is -- compiler's job or done by processor or what?
4) When 2s complement
is taken at -- compile time, run time or at the time of assiging a value to a variable?
Articles I read are (should recommend to understand 2s complement
better):