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

后端 未结 5 1652
醉酒成梦
醉酒成梦 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:31

    I compiled an example using printf("a") with -S and got call putchar in the assembly code. Looks like when you have only one char in the printf the compiler turns it into a putchar(). I did another example using printf("ab") and got call printf, with the text section in the %edi register.

提交回复
热议问题