Handling Non-Null Terminated Strings

A string_view works well with null-terminated strings. Let's see what happens when we point it to a substring which does not have a null character at the end.

If you get a string_view from a string then it will point to a null-terminated chunk of memory:

Get hands-on with 1200+ tech skills courses.