Breaking News: Grepper is joining You.com. Read the official announcement!
Check it out

Understanding the Code#

Sumit Rawal answered on May 23, 2023 Popularity 1/10 Helpfulness 1/10

Contents


More Related Answers


Understanding the Code#

0

The output of the code might not be as clear as the outputs we’ve been looking at throughout this chapter. Let’s break down what the operators are doing one step at a time.

A & B

The operator will first convert each decimal operand into its binary form.

12 in binary form is

0000

0000

1100

1100

5 in binary form is

0000

0000

0101

0101

From there, it will apply the above rules for the binary AND operator (&) on each pair of bits, i.e. the first bit of 12 with the first bit of 5 and so on.

And that is how A & B will yield a result of 4.

Try to map the rules onto the other operations and see if you get the same result as the output above.

That sums up bitwise operators. Let’s move on to our final type of operator, assignment operator, in the next lesson.

Popularity 1/10 Helpfulness 1/10 Language whatever
Source: Grepper
Tags: whatever
Link to this answer
Share Copy Link
Contributed on May 23 2023
Sumit Rawal
0 Answers  Avg Quality 2/10


X

Continue with Google

By continuing, I agree that I have read and agree to Greppers's Terms of Service and Privacy Policy.
X
Grepper Account Login Required

Oops, You will need to install Grepper and log-in to perform this action.