In printf("%d", (float) 9/ (float) 5);
what will be the output?
Note: In
printf
function the format specifier is%d
It seems that output would be 0 just like the below code return answer 0.
float a = 9/5;
printf("%d",a);
[Edited]
But not at all. The actual output is -1073741824
as a Garbage Value And that's the question. Why?
We can do the explicit typecasting to convert integer data type to float data type.
But why typecasting is not working in this printf("%d", (float) 9/ (float) 5);
code?
I know this is a stupid question but I want to know this stupidity.