{[ promptMessage ]}

Bookmark it

{[ promptMessage ]}

img012 - fi======——— 18 Contents Pitfall Inadvertent...

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

View Full Document Right Arrow Icon
Image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: fi======——— 18 Contents Pitfall: Inadvertent Local Variables 179 Tip: Choosing Formal Parameter Names 181 Example: Buying Pizza 181 4.2 OVERLOADING AND DEFAULT ARGUMENTS 184 Introduction to Overloading 184 Pitfall: Automatic Type Conversion and Overloading 187 Rules for Resolving Overloading 188 Example: Revised Pizza-Buying Program 190 Default Arguments 192 4.3 TESTING AND DEBUGGING FUNCTIONS 194 The assert Macro 194 Stubs and Drivers 195 Chapter Summary 198 Answers to Self-Test Exercises 199 Programming Projects 200 Chapter5 Arrays 205 5.1 INTRODUCTION TO ARRAYS 206 Declaring and Referencing Arrays 206 Tip: Use for Loops with Arrays 209 Pitfall: Array Indexes Always Start with Zero 209 Tip: Use a Defined Constant for the Size of an Array 209 Arrays in Memory 210 Pitfall: Array Index Out of Range 212 Initializing Arrays 212 5.2 ARRAYS IN FUNCTIONS 215 Indexed Variables as Function Arguments 215 Entire Arrays as Function Arguments 216 The const Parameter Modifier 220 Pitfall: Inconsistent Use of const Parameters 221 Functions That Return an Array 222 Example: Production Graph 222 5.3 PROGRAMMING WITH ARRAYS 228 Partially Filled Arrays 228 Tip: Do Not Skimp on Formal Parameters 228 Example: Searching an Array 231 Example: Sorting an Array 233 ...
View Full Document

{[ snackBarMessage ]}

What students are saying

  • Left Quote Icon

    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.

    Student Picture

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

  • Left Quote Icon

    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.

    Student Picture

    Dana University of Pennsylvania ‘17, Course Hero Intern

  • Left Quote Icon

    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.

    Student Picture

    Jill Tulane University ‘16, Course Hero Intern