“2ddef137fe6ee84ce7d1af9f6e3807cd90d276fa”上不存在“...gserver/git@gitcode.net:paddlepaddle/PaddleDetection.git”
提交 75d9da19 编写于 作者: F feilong

add bit op

上级 5d06581f
{
"type": "code_options",
"author": "幻灰龙",
"source": "bit_op.md"
}
\ No newline at end of file
# 位逻辑运算
下列错误的代码是?
## 答案
```c
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv){
int i = 1;
assert(i<<1==4);
return 0;
}
```
## 选项
### 选项1
```c
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv){
int i = 2;
assert(i>>1==1);
return 0;
}
```
### 选项2
```c
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv){
int i = 3;
assert((i&2)==2);
return 0;
}
```
### 选项3
```c
#include <stdio.h>
#include <assert.h>
int main(int argc, char** argv){
int i = 1;
assert((i|2)==3);
return 0;
}
```
\ No newline at end of file
......@@ -6,5 +6,7 @@
"C语言"
],
"children": [],
"export": []
"export": [
"bit_op.json"
]
}
\ No newline at end of file
# 十六进制转换
# 位字段(bit filed)
利用位域,你能声明比字符宽度更小的成员,低至1位。假设机器字是8 bytes,下面的结构体大小是?
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册