Table of Contents
Assigned reading: Britton chapter 6.
One of the most important subjects in beginning programming courses is the use of subprograms.
Without subprograms, the implementation of a program from a well-planned top-down design would be difficult. With the use of subprograms, each module in the design can be clearly represented in the implementation.
In this chapter we examine how subprograms work at the machine level, and in the process gain an understanding of the wonderfully useful illusions that high-level languages create for us, such as local variables, arguments, and recursion.
Subprograms go by many names, depending on the language. In C they are called functions, in Fortran they are called subroutines and functions, in Pascal they are procedures and functions. In C++, they are technically functions, but many C++ programmers have adopted the term methods from Java.