From the course: C: Data Structures, Pointers, and File Systems
Unlock the full course today
Join today to access over 22,400 courses taught by industry experts or purchase this course individually.
Challenge: String I/O and manipulation - C Tutorial
From the course: C: Data Structures, Pointers, and File Systems
Challenge: String I/O and manipulation
(upbeat music) - [Instructor] This chapter's Challenge comes as a single program with three parts. First, fetch string input from the user. Second, process that input, mixing it with a string literal to generate a phrase and third output the phrase. And now the details for the first part, string input. Prompt the user to type their name. Using character input only write a loop that processes those characters, storing them in a buffer called name. The buffer should hold 32 characters, so effectively you're writing your own text input function for part one. For part two, you copy the name array of the text input into a second character buffer called buffer. Then you take the text from the last array and append it to text stored in the buffer. Now the last array is a string literal and it contains the text passed the challenge. For the final part you output the contents of the character array buffer. Now don't use the puts or printf function to output the text. Instead write a loop that…
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
-
-
-
-
Using single character I/O4m 4s
-
Testing characters2m 34s
-
Working with character conversions2m 17s
-
Understanding strings in C3m 3s
-
Fetching string input3m 18s
-
Sending string output2m 46s
-
Reviewing printf() placeholders3m 8s
-
Using printf() placeholders3m 36s
-
Exploring string functions3m 29s
-
Manipulating strings3m 53s
-
Avoiding string problems2m 27s
-
Challenge: String I/O and manipulation1m 46s
-
Solution: String I/O and manipulation2m 16s
-
-
-
-
-