In this conceptual interview question, we want to Subtract 1 from a number using bit manipulations in C/C++. The answer leads to a surprising connection between 2's complement, Subtraction, and 1's complement. We learn how we can represent 2's complement in different ways. Also, we find some very interesting traits of inversion (1's complement) with regards to its additive property. Have a look!
See Bit Manipulation Interview Preparation Series here:
• Bit Manipulation Interview Series
Episode on 2's complement and subtraction: • Negative number representation, Two's Comp...
Episode on Addition using Bit Manipulation : • How to Add 1 without using Plus operator -...
You could follow us on Facebook and Instagram:
Facebook : / firmwarecode
Instagram : / firmwarecode
#bitmanipulation #bitalgorithm
コメント