Created
January 8, 2013 16:09
-
-
Save housemeow/4485004 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
#include <stdio.h> | |
#include <stdlib.h> | |
#include <string.h> | |
#include <ctype.h> | |
int main(){ | |
int i=1234; | |
char* ch = (char*)&i; | |
printf("*ch=%d\n", *ch); | |
printf("*(ch+1)=%d\n", *(ch+1)); | |
//range of char = -128~127 | |
//-128 = 10000000 | |
// 11010110 | |
// -00101010 | |
//(int) = 00000000 00000000 00000000 10000000 | |
// 127 = 01111111 | |
//(int) = 00000000 00000000 00000000 01111111 | |
//big endian | |
//(int)1234= 00000000 00000000 00000100 11010010 | |
// | |
//little endian | |
//(int)1234= 11010010 00000100 00000000 00000000 | |
// 00101110 | |
system("pause"); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment