Functions to manipulate and examine strings are defined in the string.h header file. The strlen() function returns a string's length; strcmp() compares strings; and strstr() searches strings. The strcmp() function returns zero when strings match.
- [Instructor] The C library offers a host of functions … for examining and manipulating strings. … These are defined in the string.h header file, … which must be included in your source code, … lest the compiler complain. … The three functions explored in this movie … are string length, string compare and string string, … which searches for text from one string inside another. … The string length, or strlen function, has this format: … It's single argument is a string variable or string literal. … The value returned is an integer: The number of characters … in the string. … The length doesn't count the double quotes … enclosing the string literal or the null character … at the end of the string … and escape characters within the string, … such as \n for new line, are counted as single characters. … In this exercise file, the length of the string "string" … is obtained at line nine and stored in variable len. … The printf statement reports the results. … Build and run. … And the string is 24 characters long. …
- Working with arrays
- Building a structure
- Creating an array of structures
- Testing characters
- Working with strings in C
- Using pointers to manipulate data
- Manipulating files
- Using command-line arguments
- Working with time functions
Skill Level Intermediate
1. Arrays and Structures
2. Characters and Strings
4. Files and the Operating System
5. The Interesting and Extraordinary
Next steps1m 52s
- 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.