Ditto on the historical reasons.
The creators of std::string in C++ recognized this shortcoming, so std::string can include the null character. (But be careful constructing a std::string with a null characterconstructing a std::string with a null character!)
If you want to have a C-string (or rather, a quasi-C-string) with a null character, you will have to make to make your own struct.
typedef struct { size_t length; char[] data; //C99 introduced the flexible array member } my_string; Or you'll have to keep track of the string length in some other way and pass it to every string function that you write.