当前位置:网站首页>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
边栏推荐
猜你喜欢
安科瑞为工业能效行动计划提供EMS解决方案-Susie 周
promise详解
使用PageHelper自定义PageInfo进行分页+模糊查询
ROS Experimental Notes - Install QPEP and Intel-MKL
【C语言】初识指针
细谈APP开发焦点问题:AMS 系统时间调节原理
好用的翻译插件-一键自动翻译插件软件
22年全国程序员1月薪资出炉,才知道年薪 40 万以上的有这么多?
[C language] Detailed explanation of data storage
Parse method's parameter list (including parameter names)
随机推荐
oai 采样频率计算
点云中的一些名词解释
HFCTF 2021 Internal System writeup
Geogebra 教程之 02 Geogebra初学者的 8 个基本要素
Unity--URP渲染管线实战教程系列之URP摄像机核心机制剖析
CSAPP lab
大厂面试热点:“热修复机制及常见的几个框架介绍”
进程和线程
后疫情时代,VR全景营销这样玩更加有趣!
服务器上行带宽和下行带宽指的是什么
企业小程序怎么开发自己的小程序?
sklearn.datasets.make_circles
CSDN21天学习挑战赛之折半插入排序
工作记录:DB2查询数据,当字段为空时,赋值
Cache knowledge summary
jsp中使用JDBC连接mysql的方法与实例
ROS实验笔记之——安装QPEP以及Intel-MKL
使用PageHelper自定义PageInfo进行分页+模糊查询
推进牛仔服装的高质量发展
Excel English automatic translation into Chinese tutorial