Difference between printf() and puts()

Difference between printf() and puts()

Difference between printf() and puts() in Tabular Form

The Key Difference between printf() and puts() is that printf() is used to display all types of data and messages. While puts() is used to display only string data and messages.

comparison between printf() and puts()

Comparison Chart

printf() puts()
It is used to display all types of data and messages. It is used to display only string data and messages.
It requires a format specifier to display formatted data. It does not require a format specifier to display string.
It can display multiple data at a time by multiple format specifiers in one printf( ). It is used to display only one string at a time.
Syntax:

  • printf(“list of format specifier or message”, list of variables);
Syntax:

  • puts(variable);
Example:

int x,y;
printf ("%d%d",x,y);

 

Example:

char ch[]="Hello"; 
puts(ch);

 




More Difference