2 ms·
I suspect null terminated strings predate C, C is just just one of many languages that can use them.
by GoblinSlayer 3y ago
I suspect null terminated strings predate C, C is just just one of many languages that can use them.
- masklinn 3y agoThe PDP-10 and PDP-11 assemblers had direct support for nul-terminated strings (ASCIZ directives, and OUTSTR in MACRO10) which Ritchie adopted as-is, not unlike Lisp’s CAR/CDR. It’s not entirely clear that other “high-level” languages at the time also used such a type. Although later ISA added support for it for C compatibility, whereas older ISAs tended to only support fixed-length or length-prefixed, for instance the Z80 has LDIR, which is essentially a memcpy, copying a terminated string required a manual loop.