From the course: C Essential Training

Unlock the full course today

Join today to access over 23,200 courses taught by industry experts.

C-strings

C-strings

- A primitive C string is a special case of an array, not to be confused with the string class in the standard template library. The primitive string is often called a C string. This is working .cpp from Chapter four of the exercise files. A primitive string is just a special case of an array of characters. So let's take a look at a primitive string. I can say const care and S with the brackets and initialize it with a string in quotes. And I can see out and just say, format like this, and I go ahead and build and run that and you see it prints out the string. What's interesting is that because this is simply an array of characters, we can initialize it with the string like this as a shortcut but what it really is, is the same as doing this. It's the six characters of the word string, followed by a zero value or a null terminator. When I build and run this you see that it works exactly the same because the C…

Contents