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 - C Tutorial
From the course: Complete Guide to C Programming Foundations
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
-
-
-
-
-
-
-
-
-
Using single character I/O3m 32s
-
(Locked)
Testing and converting characters3m 15s
-
(Locked)
Challenge: Character I/O and conversions34s
-
(Locked)
Solution: Character I/O and conversions1m 37s
-
(Locked)
Understanding strings in C2m 46s
-
(Locked)
Fetching string input3m 45s
-
(Locked)
Sending string output3m 41s
-
(Locked)
Challenge: Using printf placeholders1m 9s
-
(Locked)
Solution: Using printf placeholders1m 59s
-
(Locked)
Exploring string functions2m 41s
-
(Locked)
Manipulating strings2m 57s
-
(Locked)
Chapter challenge: Reading commands1m 52s
-
(Locked)
Chapter solution: Reading commands2m 31s
-
-
-
-
-