Jump to content

Recommended Posts

Posted
#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; 
        }         
} 

 

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 account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...