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

Challenge: String I/O and manipulation - C Tutorial

From the course: C: Data Structures, Pointers, and File Systems

Start my 1-month free trial

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…

Contents