You are here

Program Control Functions

5 February, 2015 - 17:35

Program Control functions normally do not communicate information to each other but use a common area for variable storage. The rules for how data is communicated in and out of a function vary greatly by programming language, but the concept is the same. The data items passed (or communicated) are called parameters. Thus the wording: parameter passing. However, with program control functions we use the data communication option of no communication in -with no communication out. Our data variables and constants are placed in a common area available to all functions (called global scope).

The identifier names for program control functions usually imply a task to be accomplished, such as get-data, process-data or show-results. As you learn to write more complicated programs the number of lines of code will increase. Prudence dictates that it would be benefcial to divide the program into functions that perform unique tasks. The larger the program the more need for modularization or creating of program control functions.

Depending on the programming language, there is a formal way to:

  1. define a function (it's definition or the code it will execute))
  2. call a function
  3. declare a function (a prototype is a declaration to a complier)

One of the easier ways to understand program control function is to view an example. Even if you don't know the C++ programming language, you can study the materials to help understand the modularization process.