博客
关于我
强烈建议你试试无所不能的chatGPT,快点击我
printf 里面嵌套 printf 会是什么结果
阅读量:7008 次
发布时间:2019-06-28

本文共 788 字,大约阅读时间需要 2 分钟。

  今天在知乎里看到这个话题。瞬间秒杀呀,还没有考虑过这个问题。
#include 
int main(int argc, char *argv[]){int a=123456;printf("%d",a);//123456printf("\n");printf("%d",printf("%d",a));//1234566 printf("\n");printf("%d",printf("%d",printf("%d",a));//12345661 printf("\n");return 0;}
 
参考 可知:
function

printf

int printf ( const char * format, ... ); Print formatted data to stdout Writes to the standard output (stdout) a sequence of data formatted as the
format argument specifies. After the
format parameter, the function expects at least as many additional arguments as specified in
format.
Return Value
On success, the total number of characters written is returned. On failure, a negative number is returned. 也即:printf返回的是打印字符的总个数。。

转载于:https://www.cnblogs.com/shaoguangleo/archive/2012/04/08/2806093.html

你可能感兴趣的文章