Table of ContentsSubPrograms Outline Outline (cont) Modularity Structured Programming What is a Subprogram? Unstructured Program Corresponding Structured Program Flow through Structured Program Reusability Parameters Transmission of Data Using Functions Function Prototype (Declaration) Function Definition Function Definition (cont) Function Definition (cont) Return Statement Function Call Function Execution Execution Example Execution Example (cont) Function Prototype Checkbook Program Checkbook Example Checkbook Example Function without Parameters Function without Parameters (cont) Passing Data to Function Parameters Passed by Value Calling PrintData Changing Local Variables Parameter Passing Rules Arguments for Parameters Changing Non-local Variables Passing by Reference Passing by Reference Example Passing by Reference Example Using Reference Variables Calls with Reference Variables Reference Arguments Functions with Return Types Function with Return Creating Functions Scope Scope Example Scope Rules Using Same Identifier Programming Practices Documenting Subprograms Developing Modular Programs Iterative Programming Iterative Programming (cont) Standard Library Functions Using Library Functions Absolute Value Functions Rounding Numbers Other Math Functions Random Numbers |
Author: Richard Maclin
Email: rmaclin@d.umn.edu Home Page: http://www.d.umn.edu/~rmaclin/ |