Sunday, 12 February 2017

The NUL terminated string in C - An Ode to the PDP-11

In C, strings are null (or NUL) terminated ("backslash 0").  The PDP-11 assembly language supported NUL terminated strings, as did Martin Richards' BCPL, the precursor of C. Dennis Ritchie found the use of a NUL terminator more convenient than having to store the length of a string. It also makes for some elegant pointer based code!

No comments: