什么是printf()和看跌期权(c)中的区别? [英] What is the difference between printf() and puts() in C?
本文介绍了什么是printf()和看跌期权(c)中的区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我知道你可以用的printf()
和打印看跌期权()
。我还可以看到,的printf()
,您可以插值变量并做格式化。
I know you can print with printf()
and puts()
. I can also see that printf()
allows you to interpolate variables and do formatting.
是看跌期权()
仅仅的原始的版本的printf()
。它应该被用于每一个可能的的printf()
无串插?
Is puts()
merely a primitive version of printf()
. Should it be used for every possible printf()
without string interpolation?
推荐答案
看跌
比的printf
简单,但要意识到前自动追加一个换行符。如果这不是你想要的,你可以的fputs
您的字符串到标准输出或使用的printf
。
puts
is simpler than printf
but be aware that the former automatically appends a newline. If that's not what you want, you can fputs
your string to stdout or use printf
.
这篇关于什么是printf()和看跌期权(c)中的区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文