int main(void) { char s[8]; s[0] = 'A'; s[1] = 'B'; s[2] = 'C' ; s[3] = '\0' ; printf("%s\n", s); return 0; }
文字列の最後にナル文字 '\0' を付け加えないといけません。