This question already has answers here:
What are bitwise shift (bit-shift) operators and how do they work?
(9个答案)
3年前关闭。
我读了一段代码,将数字转换为等效的二进制代码,其中使用了以下语句:
这样的陈述有什么用?
(9个答案)
3年前关闭。
我读了一段代码,将数字转换为等效的二进制代码,其中使用了以下语句:
1<<j
这样的陈述有什么用?
最佳答案
1<<j
这意味着将1向左移动j
次。因此,如果j
为5,则移位结果将为2^j
,如下所示:
00000001 ====> binary representation of 1
00100000 ====> binary representation of 32.
关于c - 在变量前使用移位运算符(<<)在C中意味着什么? ,我们在Stack Overflow上找到一个类似的问题:https://stackoverflow.com/questions/39958709/