您的位置:首页 > 其它

printf函数的作用

2015-10-18 14:42 260 查看
刷到一道题, 要求说出printf函数的作用. 学到了很小的知识点.

// testvc6.cpp : Defines the entry point for the console application.
//

#include "stdafx.h"

void fnTest();

int main(int argc, char* argv[])
{
	fnTest();
	getchar();
	return 0;
}

void fnTest()
{
	/// int printf( const char *format [, argument]... );

	/// Descript
	/// Print formatted output to the standard output stream.
	/// 将格式化后的输出打印到标准输出流, 
	/// 大家都知道这个函数是打印, 重点是打印到标准输出流,而不是只能打印到控制台

	/// Return Value
	///		Each of these functions returns the number of characters printed, or a negative value if an error occurs.
	///		向标准输出流打印了多少个字符, 假设是负值, 说明发生了错误
	///		这个返回值在实际工作中从来没用过, 也许做统计的时候会用到

	/// Parameters
	///	format
	///		Format control
	///		格式化控制字符串
	/// argument
	///		Optional arguments
	///		可选参数

	printf("hello\r\n");

	/**
	标准C函数库stdio.h里定义的printf函数的作用是(将格式化的输出到标准输出流), 其返回值是(int)类型, 参数是(变长参数)类型
	*/
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: