5. Topic 4 - Functions and Structured Programming

  • A function is a portion of a program which can be called to perform a task and then return to the calling program.
  • We have already seen some functions provided by the system (printf(), scanf(), sqrt (see Mathematical Functions) …) and we talked briefly about how to write our own functions. (see Functions)
  • In this topic we will discuss the following details about functions:
    1. Review of how to write and call functions.
    2. Rules related to the scope of variables used with functions. This leads directly into the general subject of data storage classes and a related, but side topic of how data and memory is managed by the computer.
    3. Program design issues as related to splitting up the program’s work into functions.
    4. Recursive functions and program design using recursion.

Contents