Created
July 6, 2022 22:52
-
-
Save Xevion/332bab8203130d4278ff9f306a5b018c to your computer and use it in GitHub Desktop.
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
// Hello world! Cplayground is an online sandbox that makes it easy to try out | |
// code. | |
#include <stdio.h> | |
#include <stdlib.h> | |
#include <stdint.h> | |
union magic { | |
uint8_t buf[4]; | |
uint32_t magic2; | |
}; | |
int main() { | |
union magic test; | |
test.buf[0] = 0x11; | |
test.buf[1] = 0x22; | |
test.buf[2] = 0x33; | |
test.buf[3] = 0x44; | |
// 44332211 | |
printf("%x", test.magic2); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment