课程: Complete Guide to C Programming Foundations
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Challenge: Returning a value
(upbeat music) - [Narrator] Take a look at this code, provided in the exercise files. Anything stick out at you? What I see are a lot of repetitive statements. To me, such a condition begs for a function. Your challenge is to examine the code in the exercise file to see where you can create a function. How can you make the code more efficient and readable? Write the function. As a hint, I call mine roll. 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.
内容
-
-
-
-
-
-
-
Understanding functions3 分钟 11 秒
-
(已锁定)
Creating a function4 分钟 52 秒
-
(已锁定)
Challenge: Writing a function39 秒
-
(已锁定)
Solution: Writing a function1 分钟 49 秒
-
(已锁定)
Returning a value from a function2 分钟 23 秒
-
(已锁定)
Challenge: Returning a value53 秒
-
(已锁定)
Solution: Returning a value2 分钟
-
(已锁定)
Passing arguments to a function2 分钟 22 秒
-
(已锁定)
Challenge: Passing values41 秒
-
(已锁定)
Solution: Passing values1 分钟 50 秒
-
(已锁定)
Using the main() function's arguments2 分钟 13 秒
-
(已锁定)
Retaining values in a function2 分钟 34 秒
-
(已锁定)
Creating recursive functions3 分钟 44 秒
-
(已锁定)
Chapter challenge: Write the functions1 分钟 14 秒
-
(已锁定)
Chapter solution: Write the functions2 分钟 15 秒
-
-
-
-
-
-
-