为什么路过的printf的结果给另一个的printf工作? [英] Why does passing the result of printf to another printf work?

查看:110
本文介绍了为什么路过的printf的结果给另一个的printf工作?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何以下code的工作?

How does the following code work?

void main()
{
    printf("%d", printf("earth"));
}

这使作为输出: earth5

推荐答案

的printf的的返回值是打印的字符数。内的printf 首先调用。等价于:

The return value of printf is the number of characters printed. The inner printf is called first. Equivalent to:

int rc = printf("earth");
printf("%d", rc);

这篇关于为什么路过的printf的结果给另一个的printf工作?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆