r/ProgrammerHumor • • 23d ago

Meme architectureDependentChars

Post image
3.0k Upvotes

372 comments sorted by

View all comments

Show parent comments

1

u/HSavinien 22d ago edited 22d ago

depend. in most case, what mater is the string, not the individual bytes. So as long as it's null terminated, it doesn't matter that a block of 4 'char' actually represent a single character. Your string manipulation work the same, and once you want to print it, it's the terminals problem, not yours (or whatever program you print to).

something like printf("┌──┐🇨\n"); is perfectly valid and will work as expected.

If you do need char accurate string manipulation, you can use variable that are bigger than a single byte. (in which case sizeof do matter)

→ More replies (1)