In this video, see a solution to this chapter's challenge.
(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 this is that whenever the user…
- Working with header files
- C constants and types
- Unformatted and formatted input/output
- Accessing files with C functions
- Generating random numbers
- Converting strings
- Sorting and searching for data
- Manipulating strings
- Using mathematical functions
Skill Level Intermediate
1. The C Standard Library
2. Input and Output Library: stdio.h
3. General Purpose: stdlib.h
4. String Functions: string.h
5. Mathematical Functions: math.h
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.