What is the syntax of printf in C? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

What is the syntax of printf in C?

Also, explain the parameters.

30th Jun 2017, 9:45 AM
Aman Mathur
Aman Mathur - avatar
3 Answers
+ 2
simple print: printf("Hello world!"); printing number: int %d float %f char %s example int x=4; printf("X = %d " ,x); // output X=4 number replaced in %d
30th Jun 2017, 10:39 AM
Elie Douaihy
Elie Douaihy - avatar
0
@elie: this is the implementation part. I want to know the general syntax.
30th Jun 2017, 10:42 AM
Aman Mathur
Aman Mathur - avatar
0
The prototype is what @Martin Taylor told you. The "..." part is an undefined number of parameter For more informations on this, search for stdarg.h. I use this in the code below, but they are some complex stuff in it so I do not know if it will help. https://code.sololearn.com/ctaBYdlTM5rP/?ref=app
30th Jun 2017, 5:05 PM
Baptiste E. Prunier
Baptiste E. Prunier - avatar