+ 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
5 Réponses
+ 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.
+ 4
Isn't this explained well enough in the C tutorial?
+ 1
Follow these posts for all types of print controls...
https://www.sololearn.com/post/137769/?ref=app
https://www.sololearn.com/post/137770/?ref=app
0
Printf means printformatted
____________⬅️____________
⬇️ ⬆️
("%d is my favourite number",3)
0
Sonic no it's not for me