From the course: C Essential Training
Unlock the full course today
Join today to access over 22,600 courses taught by industry experts or purchase this course individually.
Challenge: Complete the code - C Tutorial
From the course: C Essential Training
Challenge: Complete the code
(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…
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
-
-
-
-
-
-
-
Understanding functions3m 21s
-
(Locked)
Creating a function3m 28s
-
(Locked)
Challenge: Writing a function46s
-
(Locked)
Solution: Writing a function1m 10s
-
(Locked)
Returning a value from a function2m 33s
-
(Locked)
Challenge: Returning a value42s
-
(Locked)
Solution: Returning a value1m 40s
-
(Locked)
Passing arguments to a function1m 52s
-
(Locked)
Challenge: Passing values44s
-
(Locked)
Solution: Passing values1m 22s
-
(Locked)
Using the main() function's arguments3m 30s
-
(Locked)
Retaining values in a function2m 58s
-
(Locked)
Creating recursive functions3m 53s
-
(Locked)
Challenge: Complete the code1m 14s
-
(Locked)
Solution: Complete the code1m 31s
-
-