当前位置:网站首页>c的printf相关
c的printf相关
2022-06-11 08:37:00 【Jimmy_jimi】
当输出为41的ascii码 ’ )', ‘\41’表示八进制41,对应十进制33,33的ascii码为’ ! '。
printf("%c%c%c\n", 'H', 41, '\41');
//输出为: H)!
在scanf函数中,加了' *' 的部分会被忽略掉(跳过),即你输入的数据不会被对应的参数获取。
在printf函数中'*'表示用后面的参数替代' *'的位置,从而达到用变量控制输出格式的效果。
int a=1,b=2,c=3,d=5;
printf("%*d\n",a,d); //输出为5;等同于printf("%1d\n",d);
printf("%*d\n",b,d); //输出为 5;等同于printf("%2d\n",d);
printf("%*d\n",c,d); //输出为 5;等同于printf("%3d\n",d);//输出占 3列,不足空格补
控制格式输出
printf("%3.7s",b); //表示输出一个长度不小于3不大于7的字符串
边栏推荐
- ActiveMQ简单教程,适合初学者,学习笔记yyds
- bat 批处理单独环境打包
- Matlab学习8-图像处理之线性与非线性锐化滤波、非线性平滑滤波
- Use Jackson's @jsonproperty annotation to add one more field to the property name. Solution to the problem
- [software tool] the hacker matrix special effect software CMatrix
- Timestamp of PostgreSQL and Oracle
- AS 3744.1标准中提及ISO8191测试,两者测试一样吗?
- Is the result too different from the goal? With the help of target management, you can reach the target accurately!
- Pg/oracle database ASCII code to string custom function
- ActiveMQ simple tutorial, suitable for beginners, learning notes yyds
猜你喜欢

Uniapp plug-in development

Difference between threadpooltaskexecutor and ThreadPoolExecutor

Codetop - sort odd ascending even descending linked list

How to do a good job in project management? Learning these four steps is enough

Can not connect to local MySQL server through socket ‘/tmp/mysql. sock (2)‘

哪些Apple设备支持这次系统更新?来看你的旧Apple设备支持最新系统吗

AS 3744.1标准中提及ISO8191测试,两者测试一样吗?

Redis6 entry-level tutorial. There are integration cases. You can directly see the integration cases. It is easy to get started

Asynchronous notification mechanism of character device driver

经典图论,深度优先和广度优先,拓扑,Prim和Krukal,该来温习啦
随机推荐
Heap can also be regarded as a tree structure. It is specified that the root node must be greater than or less than the left and right child nodes, but the size order of the left and right child nodes
SAP 物料主数据归档
结果和目标出入太大?不妨借助目标管理精准直达目标!
Asynchronous notification mechanism of character device driver
Anaconda related knowledge supplement (spyder+keras Library)
Codeworks round 680 div2
uniapp 插件开发
Idea annotation settings
ActiveMQ简单教程,适合初学者,学习笔记yyds
(二)从架构设计角度分析AAC源码-我的LiveData
leetcode - 518. Change II
uniapp关闭/开启/调节系统声音
Uniapp turn off / on / adjust system sound
leetcode - 460. LFU cache
What does it mean to buy a single-mode, dual-mode and Rechargeable Wireless Mouse
Hibernate L2 cache
[node] NPM part
mysql高级特性篇,可以多看看,应付面试
木板ISO 5660-1 热量释放速率摸底测试
leetcode - 230. The k-th smallest element in a binary search tree