Skip to content

Instantly share code, notes, and snippets.

@2bbb
Last active August 29, 2015 14:23
Show Gist options
  • Select an option

  • Save 2bbb/c8c7e2a0a2c2740ab5b3 to your computer and use it in GitHub Desktop.

Select an option

Save 2bbb/c8c7e2a0a2c2740ab5b3 to your computer and use it in GitHub Desktop.
hex_print_again
#include <iostream>
union IntFloatUnion {
int i;
float f;
};
using namespace std;
int main(int argc, char *argv[]) {
IntFloatUnion u;
u.f = 7.1f;
printf("0x%04X\n", u.i);
return EXIT_SUCCESS;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment