Skip to content

Instantly share code, notes, and snippets.

@losvedir
Created October 1, 2010 00:51
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
Star You must be signed in to star a gist
Save losvedir/605558 to your computer and use it in GitHub Desktop.
#include <stdio.h>
main() {
int n[] = {1819043144, 663919}, i;
char *c;
c = (char*)n;
printf("%s", c);
}
/* Little Endian! Each byte goes forwards, but the 4 bytes go
* into the int backwards!
*
* H = oct 110 = b 01001000
* e = oct 145 = b 01100101
* l = oct 154 = b 01101100
* l = oct 154 = b 01101100
* 01101100 01101100 01100101 01001000 = 1819043144
*
* o = oct 157 = b 01101111
* ! = oct 041 = b 00100001
* \n = oct 012 = b 00001010
* \0 = oct 000 = b 00000000
* 00000000 00001010 00100001 01101111 = 663919
*/
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment