Plays from YouTube. Watch on YouTube
Why does a four-character word need five bytes in C?
Meet C Strings and Memory Safety: an original animated lesson in C and Unix systems programming.
We begin with null-terminated character arrays and explain why a string literal is not the same as writable storage.
Then we compare strlen with sizeof, trace buffer copying and bounded input, and explain why read returns bytes without adding a terminator.
The big idea: A safe string interface tracks capacity, valid length, termination and object lifetime separately.
C and Unix explained visually, one concept at a time.