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

Solution: Find a special word - C Tutorial

From the course: C Standard Library

Start my 1-month free trial

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…

Contents