Is it not possible to do explicit convertion in printf with float | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Is it not possible to do explicit convertion in printf with float

#include <stdio.h> int main() { int i=1; printf("%f",i); return 0; }

20th Oct 2018, 7:29 AM
Jishnu
Jishnu - avatar
3 Answers
0
Explicit cast would be: printf("%f", (float) i);
20th Oct 2018, 8:13 AM
Jared Bird
Jared Bird - avatar
0
why does the above program gives 0?
20th Oct 2018, 8:25 AM
Jishnu
Jishnu - avatar
0
Because the implict cast is invalid.
20th Oct 2018, 8:38 AM
Jared Bird
Jared Bird - avatar