Created
October 23, 2014 07:08
-
-
Save honux77/97fd43e92f568e714fb0 to your computer and use it in GitHub Desktop.
wrong example for Korean letter
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> | |
| #include <string.h> | |
| int main(void) { | |
| char *all = "안녕하세요"; | |
| char buf[16]; | |
| buf[0] = all[3]; | |
| buf[1] = all[4]; | |
| buf[2] = all[5]; | |
| buf[3] = '\0'; | |
| printf("%s\n", all); | |
| printf("length= %d\n", strlen(all)); //5? | |
| printf("all[3]= %c\n", all[3]); | |
| printf("all[3][4][5]= %c%c%c\n", all[3], all[4], all[5]); | |
| printf("buf = %s\n", buf); | |
| return 0; | |
| } |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
리눅스의 경우 결과물은
안녕하세요
15
?
녕
녕
이렇게 나옵니다.