CMPT 127 Lecture Notes - Lecture 15: Software Engineering

70 views2 pages

Document Summary

Reading the first 8 lines of code top-to-bottom, left-to-right, we see: line 1: a comment describing what the following function does. In the body of the function, the keyword return evaluates the expression to it"s right which becomes the function"s return value, then exits the function: the body of the function ends at the closing }. Having been defined in lines 2 to 8, function max() is called on line 15. The values of integers a and b are assigned to x and y inside max(), the function does its work, and the return value is passed as the second argument to printf(). The syntax for c functions is type functionname( type arg_name1 [, type arg_name2, ] ) // code-block function body enclosed by curly braces. Note that main() itself is a normal function. The system calls it to start the program. The name function is a little unfortunate, since these are not the same as mathematical functions.

Get access

Grade+
$40 USD/m
Billed monthly
Grade+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
10 Verified Answers
Class+
$30 USD/m
Billed monthly
Class+
Homework Help
Study Guides
Textbook Solutions
Class Notes
Textbook Notes
Booster Class
7 Verified Answers

Related Documents

Related Questions