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: Returning a value - C Tutorial
From the course: C Essential Training
Challenge: Returning a value
(upbeat music) - [Instructor] For this challenge, use exercise file 05_06-challenge1. Your job is to examine the code and see where you can create a function. How can you make the code more efficient? And then, write that function. The function you create returns a value, which is used inside the main function. This process is typical for most programmers, where you spy a repetitive chunk of code that probably would fit better inside a function. Find that code, write that function. This challenge should take you about 10 minutes to complete.
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
-
-