Bitwise Operators in C (Part 3)

preview_player
Показать описание
C Programming & Data Structures: Bitwise Operators in C (Part 3)
Topics discussed:
1. Bitwise right shift operator.
2. Example of bitwise right shift operation.
3. Right shift as division by 2 operator.

Music:
Axol x Alex Skrindo - You [NCS Release]

#CProgrammingByNeso #CProgramming #BitwiseOperators
Рекомендации по теме
Комментарии
Автор

this dude is the one i want speaking at my funeral. he has practically raised me with all of these bitwise operator videos

chrisbanas
Автор

the manner in which you have made the concepts clear, it is really appreciable

BHARATAM-cciv
Автор

Superb teaching... I learning c progaram. Form ur all videos... I can easily understand ur videos.. Tq ☺

hemalakshmi
Автор

right when I thought I was just stupid and could never actually understand bitwise operators (cuz my teacher is kind of not the best either) I watched your vids and life is so much easier now! :D Thank you man

ThePasiko
Автор

YOU MAKE IT LOOK SO EASYYYY MAN!! THANK YOUUU AGAIN!!

shritea
Автор

Thank you sir you can't even imagine that how much your help me by teaching this operators and now my doubts have been clarified thank you so much.

triptiacademycentre
Автор

You are great sir, your videos are the only source of mine to clear my doubts, please make a complete playlist of python programming.

Paiso_ka_gyan
Автор

U had clarified my doubt that no body else couldn't by explaining those important points thank u so much, u r really best teacher 😊😊😊😊

naranisrimani
Автор

Somethings are missing here, as you said when the integer is right shifted leading positions are filled with zeros this is only true if the operator is applied on "unsigned integer" in case of signed integers it will be different, i suggest you to cover that part as well so that it will be complete.

pavangm
Автор

you made concept very easy.
thanks a lot sir

pulkit
Автор

Thank you bro you're explain briefly .

girmaymedhanie
Автор

If the var is (signed) int and shift it to right then it is not guarantee that the left side will be 0. It depends on your compiler. We can say it will get 0 if the var is ungined int.

marduktr
Автор

Comments for myself: leading positions will be filled by zero. Cool fact is that return value of right shift is equal to var / (2^numOfShifts).

compangit
Автор

One note: I don't think this note is always true: Right shifting is equivalent to division by 2 on the power of the right operand. I think it's only true if the last n (n = last operand) bits of the value is 0.
In case of 10 >> 2, the result will be 2 as well, since not just the bit representing 8 (2 on 3rd) get's shifted, but the bit which holds the value of 2 (2 on 1st) is also just simply truncated.

leventemathe
Автор

How about -ve numbers? It would be better if you would have captured that as well.

bestsaurabh
Автор

In case of right shift of negative number, will it be converted to positive number because of leading zero padding ?

jaidippatra
Автор

This video is correct only for unsigned, but it is not correct for signed; specifically, Important Point 1 is not correct for signed char and signed int because for signed vars, 1 is shifted in from the left, not zero. This video is true only for unsigned.
For example, using the mingw GCC C compiler:
char test1, test2
test1 = 0xFF;
test2 = test1 >> 1;
printf("test1 = %d and test2 = %d\n", test1, test2);

Results in test1 = -1 and test2 = -1
which means that the the binary for test1 = test2 = 0xFF = b 1111 1111 which is 2s Complement -1, hence showing that 1 is repeated from the msb. If 0 was always shifted in from the left as the video states, the output would be test1 = -1 and test2 = 127.

scramjet
Автор

What if you have a negative number (the first digit is 1 then), will this operand turn the number into a positive number (shifts the 1 to the right and makes the first left bit a 0)?

smrtfasizmu
Автор

Can shifting can be done to negative number like -1, -2...

sachinjain
Автор

Hy ! I meet the syntax : j<<=1 and j>>=1; What is this?

buiciucdaniel