Created
April 30, 2014 00:02
-
-
Save nh2/f4a70df9a641ec05817d to your computer and use it in GitHub Desktop.
reinterpret_cast in C
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#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