当前位置:网站首页>C语言学习之旅 【操作符(残缺版)】
C语言学习之旅 【操作符(残缺版)】
2022-08-09 23:09:00 【51CTO】
1.1 算术操作符
- 除号
要想打印浮点型,需要符号一侧为浮点型,且数据类型为double或者float类型
- 取模
//取模操作符 的两端必须都为整数
1.2 移位操作符
- 左移/右移操作符
二进制位左移/右移动 n位
右移补位:算术右移补原符号位;逻辑右移补0
原码 ----(符号位不变,其他位按位取反)----> 反码 ----(反码+1)---->补码
1.3 位操作符
& 按位与:同1则1,其余为0
| 按位或 :有1则1 ,无1则0
^ 按位异或 :相同为0, 相异为1
备注:他们的操作数必须都是整数!
- 实例1.交换两个数
总结:
a ^ a = 0
a ^ b ^ b = a
1.4 单目操作符
!逻辑取反
sizeof 其中的表达式不参与运算
~ 按位取反 --> -1的补码是32位全1
边栏推荐
- 70. Stair Climbing Advanced Edition
- Qt 之 QDateEdit 和 QTimeEdit
- Force buckle: 279. Perfect square
- ES6 从入门到精通 # 14:迭代器 Iterator 的用法
- How to know the computer boot record?
- NTP SERVICE TASK 在GWserver配置、启用NTP服务,为当前环境提供时钟同步服务,Client主机可以从该服务器同步时间。
- 第十二,十三章 mysql数据类型,视图的课后练习
- 如何抑制告警风暴?
- mysql无法远程连接 Can‘t connect to MySQL server on ‘xxx.xxx.xxx.xxx‘ (10060 “Unknown error“)
- 经济衰退即将来临前CIO控制成本的七种方法
猜你喜欢

【Infiltration tool】Browser data export tool

【集训DAY3】中位数

MVC与MVVM模式的区别

Service Discovery @EnableDiscoveryClient

IT传奇人物菲尔德的转型经验教训及给CIO的建议

【渗透工具】浏览器数据导出工具

How to know the computer boot record?

【数据存储】signed,unsigned到底怎么区分?如何计算?

KingbaseGIS Jin Cang database using manual (6.3. Geometric object creation function)

【集训DAY4】询问【Hash】
随机推荐
用哈希简单封装unordered_map和unordered_set
Seq2Seq论文阅读笔记
信息系统项目管理师核心考点(六十四)信息安全基础知识重要概念
nfs配置
工程 (七) ——PolarSeg点云语义分割
【C语言】指针和数组的深入理解(第四期)
A Shanghai technology company was fined 220,000 for brushing orders, exposing the gray industry chain of online brushing
Click: 518. Change Exchange II
微信小程序获取微信用户步数
【集训DAY3】挖金矿【二分答案】
分布式数据库难题(三):数据一致性
【集训DAY4】异或【字典树】
ECCV 2022 | Microsoft Open Source TinyViT: Pre-training Capabilities for Small Models
[C language] In-depth understanding of pointers and arrays (issue 4)
【SSL集训DAY2】Sequence【数学】
70. Stair Climbing Advanced Edition
如何抑制告警风暴?
【JZOF】77 Print binary tree in zigzag
Wireshark经典实践和面试13点总结
What are the Shenzhen fortress machine manufacturers?Which one do you recommend?