printf函数返回值的含义
2013-06-08 11:50
337 查看
以前总是顺手使用printf函数,但是今天突然发现它还有返回值
int printf( const char *format [,
argument]... );
查了下资料说是代表输出的字符的个数。
写了段小代码测试了一下:
#include <stdio.h>
int main()
{
int a;
printf("%f\n", 5);
a = printf("%d\n", 5.01);
printf("%d\n", a);
return 0;
}
结果:
的确是输出的字符的个数,即是format字符指针包含的字符的个数,注意这里包含了‘\n’的
int printf( const char *format [,
argument]... );
查了下资料说是代表输出的字符的个数。
写了段小代码测试了一下:
#include <stdio.h>
int main()
{
int a;
printf("%f\n", 5);
a = printf("%d\n", 5.01);
printf("%d\n", a);
return 0;
}
结果:
的确是输出的字符的个数,即是format字符指针包含的字符的个数,注意这里包含了‘\n’的
相关文章推荐
- [X86] 关于/usr下的ccs,df,sfw,ucb,openwin,xpg4,xpg6的含义
- Stack的三种含义
- C++中extern “C”含义深层探索
- SQL关键字 except和except all的含义和区别
- httpclient之header的含义参考
- Makefile学习笔记<中一些特殊符号的含义和用法>
- [java web] web.xml中load-on-startup标签的含义
- tomcat里web.xml中load-on-startup参数含义
- LWIP之opt.h配置含义
- javascript中括号的几种含义
- java中volatile关键字的含义
- web.xml中load-on-startup标签的含义
- linux shell 中2&1含义
- 理解Class.forName的含义
- android:layout_weight的真实含义
- linux shell 中"2>&1"含义
- [Python]网络爬虫(一):抓取网页的含义和URL基本构成
- 关于信息论中熵的定义与含义:
- 关于各种开源协议的含义
- 如何查看Xcode Build Settings各项的具体含义