课程: Complete Guide to C Programming Foundations
今天就学习课程吧!
今天就开通帐号,24,100 门业界名师课程任您挑!
Chapter solution: Write the functions - C教程
课程: Complete Guide to C Programming Foundations
Chapter solution: Write the functions
(upbeat music) - [Instructor] The code requires you to write four functions which appear here in the main function, add, subtract, multiply, and then divide here in the printf statement. The first three functions are similar, they accept two integer arguments and they return nothing. The divide function is in the printf statement and it returns a value, but it doesn't output any text. The value must correspond to the %f placeholder here. I'll set the functions atop the source code file, which avoids me having to write the prototypes. First, I'll do the add function. The add function is a void function because it returns no values, but it does output a string according to the instructions. This is the format with a math as the third argument. You could perform the math as its own statement, but it would require an additional variable, this is kind of a shortcut way to do it. The subtract and multiply functions are similar, so I can copy and paste and then edit the signs. Here you see…
内容
-
-
-
-
-
-
-
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 秒
-
-
-
-
-
-
-