Skip to content

Instantly share code, notes, and snippets.

@honux77
Created October 23, 2014 07:08
Show Gist options
  • Select an option

  • Save honux77/97fd43e92f568e714fb0 to your computer and use it in GitHub Desktop.

Select an option

Save honux77/97fd43e92f568e714fb0 to your computer and use it in GitHub Desktop.
wrong example for Korean letter
#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;
}
@honux77
Copy link
Copy Markdown
Author

honux77 commented Oct 24, 2014

리눅스의 경우 결과물은
안녕하세요
15
?


이렇게 나옵니다.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment