c++ - Using NULL as a terminator in arrays? -
i "reinventing wheel" learning purposes, i'm working on container class strings. using null character array terminator (i.e., last value in array null) cause interference null-terminated strings?
i think issue if empty string added, might missing something.
edit: in c++.
"" empty string in c , c++, not null. note "" has 1 element (instead of zero), meaning equivalent {'\0'} array of char.
char const *notastring = null; char const *emptystring = ""; emptystring[0] == '\0'; // true notastring[0] == '\0'; // crashes
Comments
Post a Comment