Strings as Character Arrays Next Slide

Before C++ and classes, strings were stored in simple arrays of characters. Thus,
char name[12] = "Bob Dylan";
would be a simple way to create a string with an initial value. In memory, this array looks like:
--------------------------------------------------
| B | o | b |   | D | y | l | a | n | \0 |   |   |
--------------------------------------------------
The only thing special about this array is that an extra character, the nul character tells us where the string's value ends.


The C String Library - string.h (aka cstring)
Copyright © 1993-2000 by Robert I. Pitts <rip at bu dot edu>. All Rights Reserved.