【C】格式化输出--printf函数的返回值
2016-06-01 21:31
513 查看
printf函数的原型为
printf函数是有返回值的,返回值是打印的字符个数。如:
输出结果如下:
![](http://img.blog.csdn.net/20160601213014264)
字符串“hello,world\n”共12个字符,“number:12\n”共10个字符。
int printf(char *format,arg1,arg2,...);
printf函数是有返回值的,返回值是打印的字符个数。如:
#include<stdio.h> #include<ctype.h> int main() { int c,d; c=printf("hello,world\n"); d=printf("number:%d\n",c); printf("%d\n",d); return 0; }
输出结果如下:
字符串“hello,world\n”共12个字符,“number:12\n”共10个字符。
相关文章推荐
- leetcode 11. Container With Most Water-最大容器|双指针
- Hello,OS world(10分钟搞出一个简单操作系统)
- 第 31 章 项目实战-PC 端固定布局[4]
- 手动方式安装 eclipse 的svn插件 Subversive和 Subversive SVN Connectors
- Spring MVC原理
- 成长之路一,centos 配置
- C++构造函数析构函数
- Ubuntu下安装RPM文件教程
- Java IO - FileInputStream&FileOutputStream
- CodeForces362A Two Semiknights Meet(dfs)
- 编译PHP-memcache扩展
- 接口调用,输出结果为Json格式(ConvertTo-Json),提交参数给URL(WebRequest)
- Android 最火的快速开发框架XUtils
- Tomcat日志设定
- 第十四周——阅读程序(1)
- Web前端开发工程师常用技术网站整理
- List集合里面去除重复的数据
- 【刷题之路】寻找奇数次出现的数2
- Excel数据导入SQL Server
- linuxe的基础指令