当前位置:网站首页>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
边栏推荐
猜你喜欢
随机推荐
多语种翻译-多语种翻译软件免费
call,apply,bind指定函数的this指向详解,功能细节,严格和非严格模式下设定this指向
Pengcheng Cup 2022 web/misc writeup
卷积神经网络CNN详细介绍
一文带你了解 ViewModel 的使用及源码解析
Metasploit——客户端渗透
开源一夏|OpenHarmony如何选择图片在Image组件上显示(eTS)
HGAME 2022 Week3 writeup
李宏毅机器学习-- Backpropagation
数组 冒泡排序
国内vr虚拟全景技术领先的公司
Android面试冲刺:2022全新面试题——剑指Offer(备战金九银十)
mysql数据库高级操作
企业小程序怎么开发自己的小程序?
闭包详解,柯里化的含义及操作方法
HGAME 2022 复盘 writeup
Promote the high-quality development of denim clothing
[C language] Implementation of guessing number game
一条SQL查询语句是如何执行的?
Kubernetes你不知道的事









![[C] the C language program design, dynamic address book (order)](/img/bb/b44066e91219a57b653e330198e4a0.png)