Could you Explain the output how we get it and what is the meaning of %d %f %c why do we use them .. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Could you Explain the output how we get it and what is the meaning of %d %f %c why do we use them ..

//Could you Explain the output how we get it and what is the meaning of %d %f %c why do we use them, should we write them in everysingle line when we want to print some thing //and why printf is printf not print, i am kidding agnore the last question about print ☺ //I mean printf #include <stdio.h> int main() { printf("int: %d \n", sizeof(int)); printf("float: %d \n", sizeof(float)); printf("double: %d \n", sizeof(double)); printf("char: %d \n", sizeof(char)); return 0; } //output //int: 4 //float: 4 //double: 8 //char: 1

18th Aug 2019, 7:52 PM
Safaa Alnabhan
Safaa Alnabhan - avatar
5 Answers
+ 9
C uses formatted output. The 'printf' function has a special formatting character (%) — a character following this defines a certain format for a variable:   %c — characters   %d — integers   %f  — floats     printf("%c %d %f", ch, i, x); NOTE: Format statement enclosed in "..." , variables follow after. Make sure order of format and variable data types match up.
18th Aug 2019, 9:41 PM
Danijel Ivanović
Danijel Ivanović - avatar
+ 4
Isn't this explained well enough in the C tutorial?
19th Aug 2019, 5:20 AM
Sonic
Sonic - avatar
18th Aug 2019, 10:45 PM
Ajay Agrawal
Ajay Agrawal - avatar
0
Printf means printformatted ____________⬅️____________ ⬇️ ⬆️ ("%d is my favourite number",3)
18th Aug 2019, 8:13 PM
D_Stark
D_Stark - avatar
0
Sonic no it's not for me
20th Aug 2019, 4:16 AM
Safaa Alnabhan
Safaa Alnabhan - avatar