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.
Exploring string functions - C Tutorial
From the course: Complete Guide to C Programming Foundations
Exploring string functions
- [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 when you use the functions, lest the compiler get cross with you. Two examples of string manipulation functions are: string length and string compare. The string length function has this format. Its single argument is a string variable or string literal. The function returns an integer, the number of characters in the string. This is a size_t data type, an integer that represents bites of storage in memory. The length value return doesn't include the double quotes enclosing a string literal or the null character terminating the string. Escaped characters, 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 9 and stored in integer variable len. The string.h header file is included for the definition of the strlen…
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
-
-
-
-
-