C bitwise operators 🔣

preview_player
Показать описание
C bitwise operators & | ^ tutorial example explained

#C #bitwise #operators
Рекомендации по теме
Комментарии
Автор

#include <stdio.h>

int main()
{
// BITWISE OPERATORS = special operators used in bit level programming
// (knowing binary is important for this topic)

// & = AND
// | = OR
// ^ = XOR
// << left shift
// >> right shift

int x = 6; // 6 =
int y = 12; // 12 = 00001100
int z = 0; // 0 =

z = x & y;
printf("AND = %d\n", z);

z = x | y;
printf("OR = %d\n", z);

z = x ^ y;
printf("XOR = %d\n", z);

z = x << 2;
printf("SHIFT LEFT = %d\n", z);

z = x >> 2;
printf("SHIFT RIGHT = %d\n", z);

return 0;
}

BroCodez
Автор

Quick Note: For Shift Left, like Bro mentioned there's a time you shift it, it doubles.
Ex: int x = 6;
for x<<1 it's 12, x<<2 it's 24. So x<<n would be x * 2^n (2 raised to n). Thought I'd mention it :)

Thank you BroCode for everything you do!

sevanthishekar
Автор

This was very easy to understand and while being really descriptive, thank you so much for making that video!

tomsterbg
Автор

you are a legend mate! Thank you for this clear explanation!

guillaumelacroix
Автор

better than a course that i bought (74.99$) on udemy...
Thank you, very clear and understandable.

xbaleks
Автор

So bassically 12&6 is equal to 6&12 is it?

pemudahijrah
Автор

Awesome thanks for the demo on bit wise operators, super easy to understand 👍👍👍👍

Garrison
Автор

Thank you so much very easy to understand because of your video

arnavtripathiyo
Автор

i finally know what this operators means, thanks.

CoffeeDump
Автор

Oh so those scary looking math equations are actually just logic gates and boolean algebra lol

antoinebguitar
Автор

What kinds of uses do these commands have?

thatonemailbox
Автор

Thank you so much! Extremely clear, amazing explanations!

ronalbocher
Автор

Thanks for the video. Very understandable, good to get me started :)

Mathieuny
Автор

I'm grateful that I didn't skip binary in high school math class.

prumchhangsreng
Автор

Ok cool thanks my reference book did not explain shifts very well.

usurpvision
Автор

thanks bro code for the helpful tips :) and to everyone have fun programming

sais
Автор

Is it just me who noticed the text size change as the first change?

Thundergreen-ljot