专注收集记录技术开发学习笔记、技术难点、解决方案
网站信息搜索 >> 请输入关键词:
您当前的位置: 首页 > C语言

printf函数的一点有关问题

发布时间:2011-06-28 16:16:56 文章来源:www.iduyao.cn 采编人员:星星草
printf函数的一点问题
这个代码为什么会输出mor呢,这个输出格式不是一般用在浮点数的吗?
[code=C/C++][/code]
char *g="morning";
printf("%.3s",g);

------解决方案--------------------
printf HELP [.prec] How Output Precision Is Affected
.n n characters or n decimal places are printed.
If the output value has more than n characters, the output might be truncated or rounded. (Whether this happens depends on the type character.)
printf本身应有的功能,只是用的较少而已
友情提示:
信息收集于互联网,如果您发现错误或造成侵权,请及时通知本站更正或删除,具体联系方式见页面底部联系我们,谢谢。

其他相似内容:

热门推荐: