Is it not possible to do explicit convertion in printf with float | Sololearn: Learn to code for FREE!
Neuer Kurs! Jeder Programmierer sollte generative KI lernen!
Kostenlose Lektion ausprobieren
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 Antworten
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