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: Writing a function - C Tutorial
From the course: C Essential Training
Challenge: Writing a function
(upbeat music) - [Instructor] It's time for you to write a function. Use the source code provided in exercise file 05_03-challenge1 to get you started. This source code file lists calls to a function named line. The function isn't defined in the code, so your job is to write the line function. The functions job is to generate a line of 40 hyphens. The line function is a void type, which you can tell in the exercise file because it accepts no arguments and generates no output. This challenge can take up to 10 minutes to complete, but I bet you do it a lot faster.
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
-
-