当前位置:网站首页>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
边栏推荐
- postman+jmeter接口实例
- Promote the high-quality development of denim clothing
- 大厂社招:Android 高级工程师的面试题,你知道多少?
- 浅析工业互联网
- Redis - Use lua script to control the number of wrong passwords and lock the account
- 北京党建展馆vr全景制作优点有哪些
- jsp中使用JDBC连接mysql的方法与实例
- HGAME 2022 Week2 writeup
- HFCTF 2021 Internal System writeup
- 【C语言】二分查找(折半查找)
猜你喜欢
随机推荐
开启新征程——枫叶先生第一篇博客
浅析工业互联网
[C language] Implementation of guessing number game
2022牛客多校(七)K. Great Party博弈方法证明
Flink(Pometheus监控)
使用PageHelper自定义PageInfo进行分页+模糊查询
李宏毅机器学习-- Backpropagation
Talking about jsfuck coding
部分准备金银行已经过时
服务器小常识
PyTorch官方文档学习笔记(备忘)
Excel English automatic translation into Chinese tutorial
安科瑞为工业能效行动计划提供EMS解决方案-Susie 周
Configuring vim(7) from scratch - autocommands
App的回归测试,有什么高效的测试方法?
Mathematical modeling preparation knowledge
C语言%(%d,%c...)
互联网中不可缺失的网络优化:“App与Server的交互依赖于网络”
DASCTF X SU 2022 writeup
Anroid 组件化构架设计:细说为何需要使用组件化提高工程编译速度