putchar() vs printf() - Is there a difference?

后端 未结 5 1647
醉酒成梦
醉酒成梦 2020-12-16 14:50

I am currently in chapter 1.5.1 File copying and made a program like so:

#include 

/* copy input to output; 1st version */
main()
{
    int c         


        
5条回答
  •  遥遥无期
    2020-12-16 15:27

    printf is a generic printing function that works with 100 different format specifiers and prints the proper result string. putchar, well, puts a character to the screen. That also means that it's probably much faster.

    Back to the question: use putchar to print a single character. Again, it's probably much faster.

提交回复
热议问题