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

前端 未结 10 2117
长发绾君心
长发绾君心 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:48

    int puts(const char *s);
    

    puts() writes the string s and a trailing newline to stdout.

    int printf(const char *format, ...);
    

    The function printf() writes output to stdout, under the control of a format string that specifies how subsequent arguments are converted for output.

    I'll use this opportunity to ask you to read the documentation.

提交回复
热议问题