C-string definition in C / C++

A “C string” is an array of characters that ends with a 0 (null character) byte. The array, not any pointer, is the string. Thus, any terminal subarray of a C string is also a C string. Pointers of type char * (or const char *, etc.) are often thought of as pointers to strings, but they’re actually pointers to an element of a string, usually treated as a pointer to the initial element of a string.

Leave a Comment