Created
January 19, 2011 22:45
-
-
Save leegao/787047 to your computer and use it in GitHub Desktop.
C is fucking crazy.
This file contains hidden or 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
#include <stdio.h> | |
void(*swap)() = (void(*)()) "\x8b\x44\x24\x04\x8b\x5c\x24\x08\x8b\x00\x8b\x1b\x31\xc3\x31\xd8\x31\xc3\x8b\x4c\x24\x04\x89\x01\x8b\x4c\x24\x08\x89\x19\xc3" | |
"Oh, there you are Mr. Insanity..."; | |
int main(){ // works on GCC 3+4 | |
int a = 37, b = 13; | |
swap(&a, &b); | |
printf("%d%d",a,b); | |
} | |
// TIL: If you do this at work, you'll probably be fired |
sandrewh
commented
Jan 20, 2011
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment