title: void* is literally float, how to cast?
body: <p>So I'm using this C library in my C++ app, and one of the functions returns a void*. Now I'm not the sharpest with pure C, but have heard that a void* can be cast to pretty much any other *-type. I also know that I expect a float at the end somewhere from this function.</p>
  
  <p>So I cast the void* to a float* and dereference the float*, crash. darn!.
  I debug the code and in gdb let it evaluate <code>(float)voidPtr</code> and low and behold the value is what I expect and need!</p>
  
  <p>But wait, it's impossible to the same during compile time. If I write <code>float number = (float)voidPtr;</code> it doesn't compile, which is understandable.</p>
  
  <p>So now the question, how do I get my float out of this fricking void*?</p>
  
  <p>EDIT: Thanks to H2CO3 this was solved, but I see lots of answers and comments appearing and dissappering not believing that I could do (float)voidPtr in gdb. here is the screenshot.</p>
  
  <p><img src="https://i.stack.imgur.com/T6LBM.png" alt="enter image description here"></p>