Alignment is the issue for this program. If we want to convert int pointer to float pointer, that means u r casting integer pointer to float pointer and that is not same as conversion of int value to float value.
Here when p is pointing to i, that means p is pointing to the address of 10, which is an integer value. So, void pointer is converted to integer pointer. Now u want to value of integer pointer to a value of float pointer. There the problem comes. Though integer pointer is 4 Byte in 32 bit machine and float pointer is 64 Byte for same machine, but pointer conversion causes alignment issue. So, it will print 0.000000
chk code:
int a[8]={1,2,3,4,5,6,7,8};
printf("%f\n", *(float *)a);
printf("%f\n", *((float *)a+1));
printf("%f\n", *((float *)a+2));
printf("%f\n", *((float *)a+3));
printf("%f\n", *((float *)a+4));
printf("%f\n", *((float *)a+5));
printf("%f\n", *((float *)a+6));
printf("%f\n", *((float *)a+7));
Output will be
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
0.000000
The only pointer conversion can be done sometime is
sizeof(unsigned char *) == sizeof(float)
The most common issue I read here called type punning
For more you can see
https://stackoverflow.com/questions/13881487/should-i-worry-about-the-alignment-during-pointer-casting
https://stackoverflow.com/questions/13633783/how-to-convert-a-float-pointer-to-an-int-pointer-in-c-c
https://stackoverflow.com/questions/30276645/typecasting-int-pointer-to-float-pointer
https://stackoverflow.com/questions/12397432/convert-pointer-to-float