Skip to content

Instantly share code, notes, and snippets.

@nh2
Created April 30, 2014 00:02
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nh2/f4a70df9a641ec05817d to your computer and use it in GitHub Desktop.
Save nh2/f4a70df9a641ec05817d to your computer and use it in GitHub Desktop.
reinterpret_cast in C
#include <stdio.h>
int main(int argc, char const *argv[])
{
float f = 1.23;
int i = * (int *) &f;
printf("%d\n", i);
float f2 = * (float *) &f;
printf("%f\n", f2);
return 0;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment