#include int main() { // BITWISE OPERATORS = special operators used in bit level programming // (knowing binary is important for this topic) // & = AND // | = OR // ^ = XOR // > right shift int x = 6; // 6 = 00000110 int y = 12; // 12 = 00001100 int z = 0; // 0 = 00000000 z = x & y; printf("AND = %d ", z); z = x | y; printf("OR = %d ", z); z = x ^ y; printf("XOR = %d ", z); z = x > 2; printf("SHIFT RIGHT = %d ", z); return 0; }
@namansalgotra6293 Жыл бұрын
What software do you use?
@Abon963 Жыл бұрын
@@namansalgotra6293If you are talking about where he writes the code it’s "Vs code"
@md.lutfullahillabib5 ай бұрын
where is you "Bitwise Complement Operator (~ tilde) in c" tutorial? @BroCodez
@sevanthishekar43798 ай бұрын
Quick Note: For Shift Left, like Bro mentioned there's a pattern.....every time you shift it, it doubles. Ex: int x = 6; for x
@spacewizerd6 ай бұрын
thats cool thx man
@rickgrimes472 ай бұрын
Similarly Right Shift, x>>n = x/2^n, where 2^n is 2 raise to the power n.
@tomsterbg8130 Жыл бұрын
This was very easy to understand and while being really descriptive, thank you so much for making that video!
@guillaumelacroix8730 Жыл бұрын
you are a legend mate! Thank you for this clear explanation!
@keynadabyАй бұрын
I finally understood it!! I was so confused with CS50 week 4 PSET recover, now I got it, thanks!
@xbaleks4609 Жыл бұрын
better than a course that i bought (74.99$) on udemy... Thank you, very clear and understandable.
@MerrowGula6 ай бұрын
you know that the udemy courses have discounts right ?
@guilhermecampos83135 ай бұрын
Warning: just buy udemy courses when they are on sale. It happens very often (something like every other week).
@arnavtripathiyo9 ай бұрын
Thank you so much very easy to understand because of your video
@antoinebguitar28699 ай бұрын
Oh so those scary looking math equations are actually just logic gates and boolean algebra lol
@pemudahijrah2454 Жыл бұрын
So bassically 12&6 is equal to 6&12 is it?
@Vishnu-wz5ng11 ай бұрын
Yes
@Smexyman08082 ай бұрын
It's a logic operator; There is no left and right.
@saiganeshj10Ай бұрын
wonderfully explained. awesome. You are the real G.
@Garrison862 жыл бұрын
Awesome thanks for the demo on bit wise operators, super easy to understand 👍👍👍👍
@ar_felix2 ай бұрын
what is complex about the complement operator? it seems it just inverts 0 to 1 and 1 to 0
@imperialenforcer227127 күн бұрын
As someone who is in VLSI design, we do this all the time in Verilog.
@ronalbocher415911 ай бұрын
Thank you so much! Extremely clear, amazing explanations!
@marcusviniciusalves4199Ай бұрын
this is just perfect, thanks for the explanation
@prumchhangsreng9792 жыл бұрын
I'm grateful that I didn't skip binary in high school math class.
@LBCreateSpace3 ай бұрын
Amazing explanation. Thank you
@mariaangeldas1554Ай бұрын
Thank you Bro Code. U saved me for my quiz
@natesr53734 ай бұрын
Get truncated is the word I'm looking for. Thanks Bro Code. nice video
@thatonemailbox Жыл бұрын
What kinds of uses do these commands have?
@Abon963 Жыл бұрын
One use is : It can be really fast for calculations
@SoDamnMetal Жыл бұрын
@@Abon963 so, something the compiler would automatically optimize for you?
@Exploshi10 ай бұрын
to quickly find if a number is a power of two you can do "return n>0 and n&(n-1)"
@P_Ahmed_P2 ай бұрын
When you promote a friend to admin in a Facebook group, you can assign them certain permissions, which control what they can do in the group. These permissions are typically represented as a series of options, each with a corresponding value, like this: Option 1: Approve posts (value: 1) Option 2: Delete posts (value: 2) Option 3: Pin posts (value: 4) Option 4: Manage members (value: 8) Permissions can be combined using a binary system. For example, if you give your friend a permission value of 5, you’re essentially giving them a combination of options 1 and 4. In binary, 5 is represented as 00000101, where the 1s correspond to the permissions you've enabled. To check if a certain permission is included, you can use the bitwise AND (&) operator. If you want to check whether they have permission for a specific option, you can perform the AND operation between the permission value and the option's value. For example, checking if option 1 (value 1) is enabled for a permission value of 5 would look like this: 5 & 1 = 1 (True, they have permission) 5 & 2 = 0 (False, they don’t have permission) 5 & 4 = 4 (True, they have permission) This way, you can easily determine which specific permissions are granted using a single number.
@Mathieuny6 ай бұрын
Thanks for the video. Very understandable, good to get me started :)
@SuperIL127 ай бұрын
Excellent! Perfect explanation!
@Abon963 Жыл бұрын
Thanks!You made it very much easier
@CoffeeDump6 ай бұрын
i finally know what this operators means, thanks.
@Raphamerlo4 ай бұрын
Thank you. I perfectly understood.
@sais640 Жыл бұрын
thanks bro code for the helpful tips :) and to everyone have fun programming
@jacksoncobb2860 Жыл бұрын
Super helpful video! Thank you!
@nataaalia11 ай бұрын
Such a good explanation
@MonirsOfficial11 ай бұрын
Masterpiece❤
@usurpvision10 ай бұрын
Ok cool thanks my reference book did not explain shifts very well.
@cd-stephen2 жыл бұрын
Bro!!!!! You are awesome and thank you
@Jaimin_Bariya3 ай бұрын
Jp Here, Thank you :)
@BARATHBSIT3 жыл бұрын
Your a real programmer 😎
@ansoncheng64186 ай бұрын
Thank you for this
@ironmonkey19905 ай бұрын
Thank you!
@SaiTaX_the_Chile_boi2 ай бұрын
bro code the goat.
@_4p_ Жыл бұрын
where is ~ (complement operator)
@mortenlund1418 Жыл бұрын
thx and great style
@rydinorwinАй бұрын
Perfect!
@abdoumourouj65514 ай бұрын
huge respect
@hemozone9726 Жыл бұрын
thanks man
@YohayShabtiev Жыл бұрын
BIG LIKE!
@indigo_diary Жыл бұрын
Thank you so much :)
@dredogu062 жыл бұрын
Thanks bro
@itsrmbaby10 ай бұрын
شكرا
@Dexterdevloper9 ай бұрын
Thanks.
@113_bachtiardanuarta_b2 Жыл бұрын
Simple yet easy to understand
@aymanmouhcine5749 Жыл бұрын
Thank you
@lizisichinava67333 ай бұрын
TYSM
@Darkin-w11 ай бұрын
Ty :)
@Thundergreen-lj2ot6 ай бұрын
Is it just me who noticed the text size change as the first change?
@bowa11 ай бұрын
King!
@MiyamotoMusashi238394 ай бұрын
thx buddy
@Aufrichtig-und-wichtigАй бұрын
legend.
@fedorvasilev5883 Жыл бұрын
Why do you use %d ?
@atheist967211 ай бұрын
It is an format specifier it this time you know what is that....I hope you know😅😅😅😅
@trantung8474Ай бұрын
1:25
@kevingerges953910 ай бұрын
for xor , 1 OR 1 = 1: If both bits are 1, the result is , how come 1 and 1 is zero
@zakd67686 ай бұрын
X is for exclusive. Think of OR as being ok with AND. 1 OR 1 = 1 1 OR 0 = 1 Because AT LEAST 1 is 1. So OR doesn't mind both being 1. 1 XOR 1 = 0 Because AT MOST should be 1. Break it into human speech and it becomes easier. True is 1 and false is 0 a XOR b = if exclusively one operand is true, return true. Else return false. AND =BOTH OR =AT LEAST 1 XOR =AT MOST 1