Programming Interview: Set, Clear, Toggle and Get Value of a Single Bit in C (Bit Manipulation)

preview_player
Показать описание
This video lecture is produced by S. Saurabh. He is B.Tech from IIT and MS from USA.

set, clear, toggle and get value of a single bit in C (bit manipulation)

This channel is an ultimate guide to prepare for job interviews for software engineers, software test engineers, computer scientists, engineering students specially computer science and IT engineers, Master of Computer Application (MCA) and Bachelor of Computer Application (BCA) students. The content of this channel will help students prepare for C,C++, Java, data structures and algorithms. It also covers courses related to networking and database.

To prepare for programming Interview Questions on Binary Trees

To study programming Interview questions on Stack, Queues, Arrays visit

To watch all Programming Interview Questions visit

To learn about Pointers in C visit

To learn C programming from IITian S.Saurabh visit
Рекомендации по теме
Комментарии
Автор

After lot of search finally got this awesome things what i really expected. A big thanks and a true smile.

bapul
Автор

Why is always Indians with the strongest accents doing these videos ...

blackstreet
Автор

#define SET_BIT(number, Bit) (number|=(1<<Bit))#define CLEAR_BIT(number, Bit) (number&=~(1<<Bit))

ronnysingh
Автор

Your explanation of Clearing a Bit helped a ton. I didn't intuitively understand before meant that "Clear" meant "Turning Off" (setting it to 0). If it's already "Off", then it remains 0. Thanks!

Korudo
Автор

No other bits are changed during toggling (0^0 =0 and 1^0=1) so the rest of the bits remain the same.

teli
Автор

For getting the bit, with the given manipulation, we don't get the bit. We get a number which is a power of 2. So I think we need to right shift the answer by the same number again.

chetanphoenix
Автор

Chec the part about the Clear again. It seems like you are ANDing the number by left shifting the 1 in a 0000 0001. But this will not give the right answer. Its more like left shift the 0 in 1111 1110 and then ANDing to clear the respective bit position. 

balassura
Автор

You are not good in explaining things, went too fast and not at all neat.. Please reduce your pace and make the note neat, take this positively

ajidaniel
Автор

For getbit is not working.
Please tell us the procedure

mushirahmedshaikh
Автор

this is so disorganized, even with good expplanation, its unclear what part you are, since its all entangled

gbemisolaagboola