Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <cstdio>
- void print_bytes(const void *mem, int size)
- {
- char const *abyrvalg = (const char *)mem;
- const char *abr = abyrvalg;
- for (; abr - abyrvalg < size; ++abr)
- {
- printf("%i%i%i%i%i%i%i%i ", (*(abr)& (1 << 7)) >> 7, (*(abr)& (1 << 6)) >> 6, (*(abr)& (1 << 5)) >> 5, (*(abr)& (1 << 4)) >> 4, (*(abr)& (1 << 3)) >> 3, (*(abr)& (1 << 2)) >> 2, (*(abr)& (1 << 1)) >> 1, (*(abr)& 1));
- }
- }
- int main()
- {
- float a = 0;
- scanf("%f", &a);
- print_bytes(&a, sizeof(a));
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement