I'm working on a homework assignment, and this specific part of it is confusing me:
Then use masking and shifting operations to decode the number. For each of the four possible diagnostics, mask off the right-hand bit. If it is 1, set the corresponding level variable to true. Then right-shift one bit and repeat.
My only problem is that I don't know how to refer to this specific bit and check it. I tried doing this:
and learned that apparently you can't treat a number in this case like an array. So how would I be able to refer to this bit?Code:if (arg == 0b1) boolVar = true; arg = arg >> 1; //repeat for other bits