This video provides a brief description and example of strlen(), strstr(), and strcmp().
- [Instructor] Following a review of string.h,…here we have some string examination functions.…The first couple are strlen and strnlen_s…which return the length of the string sent us an argument.…As usual, the second function receives a second argument…for the maximum length before giving up.…Next we have string comparison functions.…Again we have a naive traditional function strcmp…and a safer version strncmp with a maximum length argument.…
These functions receive two strings as arguments…named as if the function was a comparison operator.…The first argument is the left-hand side string,…and the second one is the right-hand side string.…Now one thing I like about these functions…is that they don't just check if two strings are equal.…Instead, they return a negative value if the left-hand…side string is supposed to appear before the right-hand…side string in alphabetical order.…
Meaning that the left-hand side string…is less than the right-hand side string.…The return value is zero if the strings have exactly…
- 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.