What the difference between printf and puts in C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What the difference between printf and puts in C?

Both the command prints in the screen then where is the difference here?

7th Oct 2018, 10:00 AM
Hasibur Rahman
Hasibur Rahman - avatar
3 Answers
+ 6
Well, printf is used for general output whereby you can specify what (data type) and how (format) to display with format specifier. On the other hand, puts is specifically used for display string only which append a new line at the back automatically.
7th Oct 2018, 10:15 AM
Zephyr Koo
Zephyr Koo - avatar
0
If we want to print the string either we can use printf or puts, but if we want to add new line after the string, we should use puts
7th Oct 2018, 10:12 AM
MsJ
MsJ - avatar
0
I guess my concepts got more clear.....
7th Oct 2018, 10:17 AM
Hasibur Rahman
Hasibur Rahman - avatar