From the course: C Standard Library
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Solution: Find a special word - C Tutorial
From the course: C Standard Library
Solution: Find a special word
(upbeat music) - [Instructor] There are many, many ways to solve this problem. My solution may or may not look at all like yours. So if we take a look at line five, the first thing I'm doing is defining three strings. The first one is called sentence, and it's 100 characters long. The second is called word, and it's 50 characters long. These are the large string and the string to remove, respectively, and finally, I'm using a temporary string with the same length as the larger string. This will serve to hold a temporary sub-string, which I will show you shortly. There's nothing fancy in lines six through 10. I am only getting both strings, the longer and the shorter string, but I want to mention what's going on in line eight. As you can see there, we have a getchar function call. Which discards one single character. And the reason for this is line seven. As you can see, I am using the format specifier for a string that will take in anything but the new line character. So the result of…
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
-
-
-
-
-
-
String manipulation1m 21s
-
(Locked)
String manipulation example2m 3s
-
(Locked)
String examination1m 43s
-
(Locked)
String examination example8m 5s
-
(Locked)
Memory chunk operations43s
-
(Locked)
Memory chunk operations example5m 13s
-
(Locked)
Challenge: Find a special word59s
-
(Locked)
Solution: Find a special word6m 25s
-
-
-