Bit Manipulation- Get & Set Bits

At 5:30, we see that Prateek sir starts the counting of the bits from the 0th bit instead of 1st.
Please explain.

hello @yajurkhurana

to access first bit we need to shift the number by 0 position to right that why i=0.
similarly to access second bit we need to shift the number by 1 position to right that is why 1.
in general to access ith bit of number we need to shift the number by i-1 position to the right

1 Like

I hope I’ve cleared your doubt. I ask you to please rate your experience here
Your feedback is very important. It helps us improve our platform and hence provide you
the learning experience you deserve.

On the off chance, you still have some questions or not find the answers satisfactory, you may reopen
the doubt.

@yajurkhurana
do u still have any doubt in this?