How to know the bits of the numbers..? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

How to know the bits of the numbers..?

Is Bitwise used only when we know that number bits...? why we use that bitwise operators??

31st Oct 2022, 3:49 PM
mon
5 Answers
+ 2
mon have a look at this series of lessons in Bitwise Operations in the Community section: https://www.sololearn.com/learn/4070/?ref=app
1st Nov 2022, 6:36 AM
Brian
Brian - avatar
3rd Nov 2022, 7:08 AM
mon
+ 2
mon The lesson didn't mention any need to know how many bits there is in a number, where did you get the idea it was necessary? https://www.theserverside.com/definition/bitwise-operator
3rd Nov 2022, 9:55 AM
Ipang
+ 1
Do you have any code which raised this question in your mind?
31st Oct 2022, 5:54 PM
Ipang
0
example of simple bitwise practical usage {a: 1, b:2, c:4, d:8} flags store b,c,d status to one byte 2 + 4 + 8 = 14 0000 1110 are c,d activated ? 4 + 8 = 12 14 and 12 = 12 // yes are a,b activated ? 1 + 2 = 3 14 and 3 = 2 // no
31st Oct 2022, 8:15 PM
zemiak