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 Tutorial
From the course: C Essential Training
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…
Practice while you learn with exercise files
Download the files the instructor uses to teach the course. Follow along and learn by watching, listening and practicing.
Contents
-
-
-
-
-
-
Overview of data types3m 21s
-
(Locked)
Integer types2m 43s
-
(Locked)
Floating point types6m 51s
-
(Locked)
The auto type4m 2s
-
(Locked)
Qualifiers4m 33s
-
(Locked)
Type aliases2m 5s
-
(Locked)
Primitive arrays5m 23s
-
(Locked)
C-strings4m 37s
-
(Locked)
Structures2m 50s
-
(Locked)
Challenge: Library card2m 9s
-
(Locked)
Solution: Library card1m 16s
-
-
-
-
-
-
-