I tried to print float using %d
(I know that this shouldn't be done.
But every time re-run executable it gives out a different value)
My question is : Why does the printed value changes every time ?
My System : Ubuntu 14.04 (64 bit)
Compiler : 4.8.4
Here is the code:
#include<stdio.h>
int main(){
float b = 12.3456;
printf("%d\n",b);
}
Sample output:
4bh1@mybox:~/C-fi$ ./test
-1629995944
4bh1@mybox:~/C-fi$ ./test
1147348376
4bh1@mybox:~/C-fi$ ./test
-1746005432
4bh1@mybox:~/C-fi$ ./test
510102216
4bh1@mybox:~/C-fi$