What is the difference between printf() and puts() in C?

前端 未结 10 2112
长发绾君心
长发绾君心 2020-12-07 07:27

I know you can print with printf() and puts(). I can also see that printf() allows you to interpolate variables and do formatting.

10条回答
  •  时光说笑
    2020-12-07 07:45

    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.

提交回复
热议问题