SubhanUllah Posted October 13, 2022 Report Posted October 13, 2022 #include <stdio.h> int main(){ printf("%d, %d\n", sizeof(float), sizeof(long)); // to show they are both 4 bytes union uni{float f; long i;} u; u.f = 123.456; printf("%lX\n", u.i); // show bits in hex int i; for(i = 0; i<32; i++){ // all bits, reversed: putchar('0' + (u.i & 1)); u.i >>= 1; } }
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now