The problem is the following:
#include <iostream.h>
void Main () {
int k=1;
int *f=&k;
* (float*) (f) = 1;
cout<<*f;
}//output why not 1?
At this point, we are able to see the formatted transformations in the function. Assuming that the format conversion exists in addition to void format, there are two and more than two of the format of the conversion, then the pointer refers to the memory of the variable will change, resulting in a corresponding change in format
For the subject:
When you force an int pointer into a float pointer, the data actually goes beyond the range of memory space defined by int
For example int occupies 4 bytes float occupies 8 bytes start k=1 stored in 4 bytes
When you convert the pointer to float, he reads 1 of the four bytes and the extra four bytes after it so it's definitely not 1, as for what would be random.
Pointer type casting