I am not able to figure out the knowledge gap for the below piece of code.
I assume that the float variable to have an value equal to that of i , but it always prints 0.000. Am I missing something?
outputCode:int main() { unsigned long i =25,j=90; float d,m; short k; memcpy((void *)&d,(void *)&i,sizeof(float)); memcpy((void *)&k,(void *)&i,sizeof(short)); printf("Print......i:%d, d:%f, k:%d\n",i,d,k); return 0; }
Print......i:25, d:0.000000, k:25
Thanks in Advace