Comment on Go enjoy Python3Comments−_pmf_11yOf course, the C version could be just printf("(%.12s)\n", argv[1]);−pjmlp11yAssuming using 7 bit ASCII−_kst_11yNo, it merely assumes one byte per character. For example, it would work correctly in Latin-1 or EBCDIC.In any case, the problem statement (though it's a bit vague) requires building a truncated string, not just printing it.−pjmlp11yIt is enough to have mixed 8 byte code pages and then it is worthless.−kevin_thibedeau11ys/printf/sprintf/
Comments
Of course, the C version could be just
Assuming using 7 bit ASCII
No, it merely assumes one byte per character. For example, it would work correctly in Latin-1 or EBCDIC.
In any case, the problem statement (though it's a bit vague) requires building a truncated string, not just printing it.
It is enough to have mixed 8 byte code pages and then it is worthless.
s/printf/sprintf/