当前位置:网站首页>[C language] do you really know printf? (printf is typically error prone, and collection is strongly recommended)
[C language] do you really know printf? (printf is typically error prone, and collection is strongly recommended)
2022-07-26 07:19:00 【rookieﻬ°】
List of articles
What is? printf()?
What we know printf Is to print out characters , Figures, etc. , But you know printf What is the return type of ?
after cplusplus.com Query for , hear printf The return type of is int type , The returned value is the total number of characters written .
Go straight to the topic ,printf The fallibility of
printf("%d ",printf("%d",printf("%d",43)));
Do you know the result of this statement ?
Think about it ~~~
Actually , The print result of the above statement is :4 3 2 1
- Why? ?
because , From the inside outprintf("%d ",43) Print is 43, Is that right ?
then , Because a total of two characters are written (43), So the one aboveprintf("%d ",43)The return value of is 2;
Give it to the nextprintfPrint , Print out 2;
then , Print 2 A total of 1 Characters , thereforeprintf("%d",2);The return value of is 1;
Return value 1 By the last oneprintf();Print , End of sentence ;
Do you understand ?
边栏推荐
- Deep learning visualization
- Leetcode 1184:公交站间的距离
- NFT数字藏品开发:数字艺术藏品赋能公益平台
- NLP自然语言处理-机器学习和自然语言处理介绍(三)
- Rgb-t tracking - [dataset benchmark] gtot / rgbt210 / rgbt234 / vot-2019-2020 / laser / VTUAV
- How regular expressions write variables
- "Wei Lai Cup" 2022 Niuke summer multi school training camp 1 supplementary question record (acdgij)
- NFT数字藏品系统开发:数字藏品赋予品牌新活力
- 5、多表查询
- [yiku] wonderful! This library organization NPM script is simply explosive!
猜你喜欢

Airiot IOT platform enables the container industry to build a welding station information monitoring system

Qt:列表框、表格、树形控件

Idea -- use @slf4j to print logs

Check the top 10 best graphics software of the year, meet 99% of your chart needs, and collect it quickly

The interface automation test with a monthly salary of 12k+ takes you to get started in 3 minutes

File server fastdfs

Advanced Mathematics (Seventh Edition) Tongji University General exercises two person solution

NFT数字藏品开发:数字藏品与NFT的六大区别

【C语言】你真的了解printf吗?(printf典型易错,强烈建议收藏)

Drools(2):Drools快速入门
随机推荐
Getting started with kernel PWN (5)
正则表达式如何写变量
6. Combined data type
NFT digital collection development: digital art collection enabling public welfare platform
单身杯web wp
Apache DolphinScheduler 2.X保姆级源码解析,中国移动工程师揭秘服务调度启动全流程
QT: modal, modeless, text box, button, single line input box
It's another summer of open source. 12000 project bonuses are waiting for you!
PG operation and maintenance -- logical backup and physical backup practice
shape 和 size() 区别
20220725 convolution in automatic control principle
QT: list box, table, tree control
WPS or office compression of ppt
PXE高效批量网络装机
Business secret series -- Talking about the evaluation of commercial passwords from the perspective of Party A and Party B (I)
7月消息,Glassnode数据显示,Deribit上ETH永续期货合约未平仓头寸刚刚达到一个月高点237,959,827美元。
404 page best practices to improve user experience
Leetcode:749. isolate virus [Unicom component + priority queue + status representation]
NLP自然语言处理-机器学习和自然语言处理介绍(三)
mysql语法(二)(纯语法)