看C语言文档,函数的参数代表什么意思printf(const char *format, arglist).里面的参数什么意思,全点啊!

[复制链接]
查看11 | 回复4 | 2012-7-23 13:43:09 | 显示全部楼层 |阅读模式
int printf(const char *format,[argument]);format 参数输出的格式,定义格式为:%[flags][width][.perc][F|N|h|l]type规定数据输出方式,具体如下:1.type 含义如下:d 有符号10进制整数i 有符号10进制整数o 无符号8进制整数u 无符号10进制整数x 无符号的16进制数字,并以小写abcdef表示X 无符号的16进制数字,并以大写ABCDEF表示f 浮点数E/e 用科学表示格式的浮点数g 使用%f和%e表示中的总的位数表示最短的来表示浮点数 G 同g格式,但表示为指数c 单个字符s 字符串S wchar_...
回复

使用道具 举报

千问 | 2012-7-23 13:43:09 | 显示全部楼层
const char *format表示一个只读的字符串(在printf函数里的实际含义的格式串,为了格式化输出)arglist表示不定参数列表,表示后跟不定个参数。所以printf的使用像这样:printf("Hello %s,%d", "world", 1);这里"Hello %s,%d"是format参数,"world" , 1这两个参数是...
回复

使用道具 举报

千问 | 2012-7-23 13:43:09 | 显示全部楼层
char * s;
// declare a pointer s points to a memory address, this could be on heap or stack
// use *s to read data out, this data can ...
回复

使用道具 举报

千问 | 2012-7-23 13:43:09 | 显示全部楼层
前面是输出格式,后面是输出的内容...
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 立即注册

本版积分规则

主题

0

回帖

4882万

积分

论坛元老

Rank: 8Rank: 8

积分
48824836
热门排行