How to create an integer whose binary representation is : 000...01101110
So the first three bits from left are 0 and right most 8 bits are given
one way I can think of is declaring an integer like int k =0b000....01101110;
What are other ways which could be used to declare an int like this?
Asked
Active
Viewed 157 times
0

ravan
- 37
- 3
-
2What's wrong with the one way that you know? Why do you need more ways than that? – Joseph Sible-Reinstate Monica Jul 10 '21 at 05:09
-
If you wish to work with binary numbers, I would recommend storing them in arrays. – Kitswas Jul 10 '21 at 05:10
-
You can use bit shifting and masking. It's not clear what you're trying to accomplish. Where do the middle bits with `...` come from? – Barmar Jul 10 '21 at 05:12
-
The value of an int is irrelevant for the declaration. Please decide what you want do with your int: output, init, read from user... – Yunnosch Jul 10 '21 at 05:25