当前位置:网站首页>C language% (%d,%c...)
C language% (%d,%c...)
2022-08-10 23:41:00 【There are gods in the mountains】
In addition to the remainder, the symbol % has another meaning as a leading character; such as %d,%c...
Here are some (not in-depth):
1. %d integer output, usually used to output int type
(A number can be inserted between "%" and the letter to indicate the field width. For example, %2d means outputting a 2-bit integer number, which is not enough for 2-bit right-alignment; %-2d means left-alignment)
2. %ld long integer output, usually used to output long type
3. %s is used to output strings, usually used to output char type
4. %c is used to output characters, char type
5. %p pointer value (print pointer address)
6. %f is used to output decimals. By default, 6 decimal places are reserved, such as 1.000000; usually used to output float type
%.2f is used to output decimals, with two decimal places, such as 1.00
7. %ld is a double-precision floating-point type, which retains 6 decimal places by default, which is usually used to output double type
8. %e outputs real numbers in exponential form,
9. %g automatically selects f format or e format according to the size, and does not output meaningless zeros.
10. %o output integer as octal number
11. %x prints an integer as a hexadecimal number, or the address of a string
12. %u outputs unsigned data (unsigned number) in decimal.
Note: %d and %u have an unsigned value range, that is, the limit value, otherwise the value will be printed incorrectly
边栏推荐
- 3d虚拟现实数字化展厅给予参观者充分的交互性和空间感
- PlaidCTF 2022 Amongst Ourselves: Shipmate writeup
- 《剑指offer》题解——week2(持续更新)
- Geogebra 教程之 02 Geogebra初学者的 8 个基本要素
- How to quickly grasp industry opportunities and introduce new ones more efficiently is an important proposition
- 鲜花线上销售管理系统的设计与实现
- Parse method's parameter list (including parameter names)
- 阿里P7晒出1月工资单:狠补了这个,真香...
- Rust从入门到精通05-语句和表达式
- [C language] Detailed explanation of data storage
猜你喜欢
随机推荐
使用PageHelper自定义PageInfo进行分页+模糊查询
ROS Experimental Notes - Install QPEP and Intel-MKL
编程语言为什么有变量类型这个概念?
【C语言】二分查找(折半查找)
缓存知识总结
线程相关知识点
性能不够,机器来凑;jvm调优实战操作详解
Cache knowledge summary
PyTorch官方文档学习笔记(备忘)
服务器上行带宽和下行带宽指的是什么
String
HFCTF 2021 Internal System writeup
CW614N铜棒CuZn39Pb3对应牌号
烘干衣服问题
Activiti7子流程之Call activity
CSDN21天学习挑战赛之折半插入排序
22年全国程序员1月薪资出炉,才知道年薪 40 万以上的有这么多?
6.0深入理解MySQL事务隔离级别与锁机制
[C language] binary search (half search)
一条SQL查询语句是如何执行的?