Link to home
Start Free TrialLog in
Avatar of ms_shubha
ms_shubha

asked on

Puts and Printf

What is the difference between puts and printf?
ASKER CERTIFIED SOLUTION
Avatar of Exceter
Exceter
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
puts can be used to print only character string. plus additional newline
printf can be used to print (formatted and unformatted both) ..any data.. string .. character,double,float, ...

for
char *str;
puts(str) will be equivalent to
printf("%s\n",str);
Avatar of ms_shubha
ms_shubha

ASKER

Puts prints a string and also printf when we give %s.So I wanted to know what exactly is the difference between the two.He gave a perfect answer.Thank you.