# img011 - Contents 1 7 Chapter 3 Function Basics 119 3.1...

This preview shows page 1. Sign up to view the full content.

This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: Contents 1 7 Chapter 3 Function Basics 119 3.1 PREDEFINED FUNCTIONS 120 Predefined Functions That Return a Value 120 Predefined void Functions 125 A Random Number Generator 127 PROGRAMMER-DEFINED FUNCTIONS 131 Defining Functions That Return a Value 131 Alternate Form for Function Declarations 134 Pitfall: Arguments in the Wrong Order 135 Pitfall: Use of the Terms Parameter and Argument 135 Functions Calling Functions 135 Example: A Rounding Function 135 Functions That Return a Boolean Value 138 Defining void Functions 139 return Statements in void Functions 141 Preconditions and Postconditions 141 main ls a Function 143 Recursive Functions 144 SCOPE RULES 145 Local Variables 145 Procedural Abstraction 148 Global Constants and Global Variables 149 Blocks 152 Nested Scopes 152 Tip: Use Function Calls in Branching and Loop Statements 153 Variables Declared in a for Loop 153 Chapter Summary 154 Answers to Self—Test Exercises 154 Programming Projects 158 Chapter 4 Parameters and Overloading 165 4.1 PARAMETERS 166 Call-by-Value Parameters 166 A First Look at Call-by-Reference Parameters 169 Call-by-Reference Mechanism in Detail 171 Constant Reference Parameters 173 Example: The swapValues Function 174 Tip: Think of Actions, Not Code 175 Mixed Parameter Lists 176 Tip: What Kind of Parameter to Use 177 ...
View Full Document

{[ snackBarMessage ]}

### What students are saying

• As a current student on this bumpy collegiate pathway, I stumbled upon Course Hero, where I can find study resources for nearly all my courses, get online help from tutors 24/7, and even share my old projects, papers, and lecture notes with other students.

Kiran Temple University Fox School of Business ‘17, Course Hero Intern

• I cannot even describe how much Course Hero helped me this summer. It’s truly become something I can always rely on and help me. In the end, I was not only able to survive summer classes, but I was able to thrive thanks to Course Hero.

Dana University of Pennsylvania ‘17, Course Hero Intern

• The ability to access any university’s resources through Course Hero proved invaluable in my case. I was behind on Tulane coursework and actually used UCLA’s materials to help me move forward and get everything together on time.

Jill Tulane University ‘16, Course Hero Intern