In this challenge, update the course program to incorporate functions where appropriate. It's important to spot which parts of the code are prime targets for functions so that they eliminate repetitive chunks of code or provide a good way to self-document. Review your code often to find parts that can be streamlined, specifically by making a function to do the heavy lifting.
(cheerful music) … - [Narrator] This chapter's course challenge … is the final step in creating the program. … Well, honestly, the program's already done, … but your challenge here is to optimize the code … by creating some functions. … Use your solution from chapter four's course challenge … or use mine provided in exercise file, … 5_14-challenge1, … create two functions. … The first is to generate the separator row. … The second is to output a newline. … The good news is that most of this code is written. … To create the functions, … you merely pull out the code from the main function. … Call one of the functions newline its sole job is … to output the new line character. … The second function is separator row. … Its duty is to generate the separator row. … This function requires two arguments, … a repeat count and the character to repeat … and ensure that you call these functions … as necessary throughout your code, prototype, … and all that stuff you learned in this chapter. … This exercise should take you about 10 dedicated minutes …
- Writing your first C program
- Working the C development cycle
- Adding comments to code for clarity
- C language data types
- Declaring variables
- Making new data types
- Typecasting variables
- Using math, assignment, and logical operators
- Creating for and while loops
- Nesting loops
- Creating functions
- Returning values from functions
- Passing arguments to functions
- Creating recursive functions
Skill Level Intermediate
C: Data Structures, Pointers, and File Systemswith Dan Gookin2h 57m Intermediate
1. The Fundamentals of C
2. Variables and Values
3. Operators and Math
4. Decisions and Loops
Next steps1m 38s
- Mark as unwatched
- Mark all as unwatched
Are you sure you want to mark all the videos in this course as unwatched?
This will not affect your course history, your reports, or your certificates of completion for this course.Cancel
Take notes with your new membership!
Type in the entry box, then click Enter to save your note.
1:30Press on any video thumbnail to jump immediately to the timecode shown.
Notes are saved with you account but can also be exported as plain text, MS Word, PDF, Google Doc, or Evernote.