From the course: Complete Guide to C Programming Foundations

Unlock the full course today

Join today to access over 24,800 courses taught by industry experts.

Manipulating strings

Manipulating strings

- [Instructor] Two popular string manipulation functions in the standard C library are string copy to copy strings and string cat to concatenate strings or append one string to the end of the other. These functions are defined in these string.h header file, which must be included in your source code. The string copy function has this format. The first argument is a destination buffer. The second argument is the source string, which is copied to the first arguments buffer. It's vital that the destination buffer be large enough to accommodate the string copied into it. Remember, this is how you copy strings in C. You do not use the assignment operator as is done in other programming languages. To combine two strings, you use the string cat function where cat means concatenate. That's eunuchs nerd speak for sticking one thing to the end of the other. The string cat function requires two arguments. The first is a string or character buffer, to which the second argument is appended. It's…

Contents