From the course: C Standard Library

Unlock the full course today

Join today to access over 22,400 courses taught by industry experts or purchase this course individually.

String manipulation example

String manipulation example - C Tutorial

From the course: C Standard Library

Start my 1-month free trial

String manipulation example

- [Speaker] So here we have, as usual, some codes with comments to fill in the blanks. And in this application, I will use three strings that we have in lines five, six, and seven. These say, hi, there, and some dashes. So as written in lines 12 and 13 I will first concatenate string one and two so that I get, hi there. And remember that the function strncat does it by upending string two to string one. And then I will copy the whole content of string one, which now says hi there to the string number three. And so both string one and string three will read the same thing. And as you can see, I print string one, two, and three before doing those changes and after doing them. So let's write those two lines. So to concatenate both strings, let me run strncat, string one, string two, and the maximum number of characters I want to concatenate. So let me use 10. And now to copy string one into string three, I'll use strn copy, str3 which is the destination, str1 which is the source, and the…

Contents