Bitwise Operators in C (Part 3)
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.
C Programming Lectures: goo.gl/7Eh2SS
Follow Neso Academy on Instagram: @nesoacademy(bit.ly/2XP63OE)
Follow me on Instagram: @jaspreetedu(bit.ly/2YX26E5)
Contribute: www.nesoacademy.org/donate
Memberships: bit.ly/2U7YSPI
Books: www.nesoacademy.org/recommende...
Website ► www.nesoacademy.org/
Forum ► forum.nesoacademy.org/
Facebook ► goo.gl/Nt0PmB
Twitter ► / nesoacademy
Music:
Axol x Alex Skrindo - You [NCS Release]
#CProgrammingByNeso #CProgramming #BitwiseOperators
Пікірлер: 61
this dude is the one i want speaking at my funeral. he has practically raised me with all of these bitwise operator videos
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 😊😊😊😊
the manner in which you have made the concepts clear, it is really appreciable
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
@studyphile6328
5 жыл бұрын
As they say,there is no bad student,only bad ..
@harshmk1052
4 жыл бұрын
This comment is so much damn relatable :P :P
@ashwinivaidya4183
Жыл бұрын
Exactly 💯... Same feeling..
@mrtechthisout
Жыл бұрын
turns out i'm not that dumb either
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.
You are great sir, your videos are the only source of mine to clear my doubts, please make a complete playlist of python programming.
YOU MAKE IT LOOK SO EASYYYY MAN!! THANK YOUUU AGAIN!!
Great video. Thanks a lot:)
Great video sir, so much helpful
Superb teaching... I learning c progaram. Form ur all videos... I can easily understand ur videos.. Tq ☺
Nice sir u r doing a great job......
you made concept very easy. thanks a lot sir
Thank you!!
Thanks a lot 💞💞💞💞
a very nice explanation!!
this is extremely clear...
Thank you bro you're explain briefly .
Thank you
Amazing Explained 😘♥️
Thank u so much sir
Thanks
great!
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.
Thank u
thank you
Nice
Best sir
In case of right shift of negative number, will it be converted to positive number because of leading zero padding ?
nice expalnation
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.
@LorenHelgeson
3 жыл бұрын
It's an important distinction for sure, and I would like to know. I'm currently learning bitwise operations as they are used in C, and when it comes to bitwise operations on a signed integer, my teacher's answer is simply "Don't. Make sure your operands are always unsigned." But, why?
@marduktr
3 жыл бұрын
@@LorenHelgeson if the var is negative, some compilers want to keep it negative and add 1 to the left side. Others do not pay attention to keeping the number negative and they are adding 0. Adding 1 is called arithmetic feeding and adding 0 is called logic feeding.
@mislead1070
2 жыл бұрын
But wait, wasn't the variable used in the video signed? Bec "%d" is used for displaying signed integers and thats what is used in the video
@st_prashant_jung_shumsher_rana
11 ай бұрын
You are wrong he has used signed char in code so your statement won't make a sense
Can shifting can be done to negative number like -1,-2...
Sir is itonly for decimal no.? Or other no.system
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)?
Hy ! I meet the syntax : j=1; What is this?
How you got output 1 in right shift whereas output 6 in left shift? I noticed that in left shift, you counted all the remaining zeros whereas in right shift you counted only the the number of places right shifted which is 1. Can you explain that?
why this is an error #include int main(){ float var = 3.0; int var2 =1; printf("%.2f",var >> var2 ); return 0; } and 3>>1 = 3/(2^1) =1.5 , so how to print 1.5
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.
How about -ve numbers? It would be better if you would have captured that as well.
🙏🙏💯
Hope you would come back (youtube)
OP
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).
bro can u increase ur volume in next videos
I need answer for homework question for clarification sir
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 ", 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.
I have a doubt...At last the video u give the explanation...3/2 u get remainder as 1 and that is the answer and the second case 32/16 you got 2....And said this is the answer while remainder is 0 how it can be possible...??
@MatteoYTGaming
4 жыл бұрын
You don't take the reminder
Why u have putted non skiping of video ,it actually seems to be worst . The video is not skipping by 10 sec if i download it
Reality to India ki kuch aur hi hai... Kabhi time mile to Depth me Jana...
how can i like twice ?? 💚💚💚💚💙💙
Save cows🙏🙏🙏
Thanks
Nice