Additional note: the string literal itself is an array and has not yet degraded into a pointer. sizeof "hello" is 6.
But you can't put such elements in an array without them degrading (at least, not that I know of).
C-strings are arrays of char that have terminating null.
i'm actually wondering, what is C-string means..? is there other type of string than C-string? are std::string are not C-string..?
@lastchance: i mean, a function to displayed the complete length, including null-terminated character, without any additional code (i.e. without +1 anymore)
Correct, std::string is a class that exists within the C++ standard library, accessible from the <string> header. "C-strings" are just the built-in null-terminated character arrays in the C and C++ languages. You can make your own functions to operate on them, or use the existing functionality (like strlen, strcpy) found within <cstring> (<string.h> in C).
std::strings take care of dynamically allocating/deallocating memory on their own, and can be resized dynamically; it takes a lot more work to dynamically resize c-strings.
The C language does not have "fancy objects". However, the C Standard Library has set of functions that operate on null-terminated array of char. The strlen() is one of those.
Those functions are declared in string.h; the cstring is a C++ Standard Library header -- a C++ wrapper for C's string.h.
It is clearly easier to say "string" than "null-terminated array of char", and "C-string" rather than "what is called string in C".
The C++ Standard Library std::string is a class. Whether it internally uses null-terminated array of char or not is not our concern.
If you want a function that does +1, you can write a helper: