Arrays, Vectors, and Strings: A
Deeper Dive
Character Arrays and String Literals in C
A character array is a collection of
characters, including the null
character \0.
String literals are enclosed in double
quotes, e.g., "hello".
A string literal is an array of
characters, including the null
character.
Two string literals with the same
content are guaranteed to have the
same address.
C Style Strings and C++ Strings
A C style string is a character array
that ends with the null character \0.
A C++ string is a template class that
stores a sequence of characters.
Deeper Dive
Character Arrays and String Literals in C
A character array is a collection of
characters, including the null
character \0.
String literals are enclosed in double
quotes, e.g., "hello".
A string literal is an array of
characters, including the null
character.
Two string literals with the same
content are guaranteed to have the
same address.
C Style Strings and C++ Strings
A C style string is a character array
that ends with the null character \0.
A C++ string is a template class that
stores a sequence of characters.