From the course: C Standard Library
Unlock this course with a free trial
Join today to access over 25,300 courses taught by industry experts.
String examination example - C Tutorial
From the course: C Standard Library
String examination example
- [Instructor] All right, so let's illustrate the string compare and strstr functions. In this application, I have written a main function in line seven that defines for strings. They say strings in some programming language are easy. And next I have a series of calls to a compare function that will compare pairs of those strings, and my compare function will print out which of the strings is greater than the other or less or if they are equal. That's why I made a function right there. So our first task in line four is to write that function. So our next task will be, as you can see in line 18, we have a substring definition. It's initialized as Java, and we will look for that substring within one of those strings. And so I'll write some code there so that you can see strstr working. Okay, so let's start with the compare function. I'll start writing codes in line five, and it's as easy as calling the STRN Compare function and analyzing its results. So let me define an integer called…
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
-
-
-