I'm trying to cast double to float pointer but I don't know the proper way to do it.
Here's my code
#include <iostream>
int main(int argc, const char * argv[]) {
// insert code here...
float *f;
double d = 10;
f = reinterpret_cast<float*>(&d);
d = 20;
std::cout << "RESULT : " << *f << std::endl;
return 0;
}
And I get the following result.
RESULT : 0
Program ended with exit code: 0
How do I properly cast double to float pointer?
ADD : The result I expect to get is 20