Video Lesson 7.2: Parameter Passing – Structures And Internal Tables

In this lesson you will learn how the interface of a subroutine is used to pass parameters and how the different transfer types are used.

  • You can address all (global) variables defined in the main program from a subroutine.
  • But, in order to call up a subroutine for a specific situation with different data objects for each situation, you do not use global variables in the subroutine but placeholders.
  • These placeholders are called formal parameters.
  • They form the interface of the subroutine, which has to be declared when the subroutine is defined.
  • When the subroutine is called, formal parameters must be specialized by means of corresponding global variables (actual parameters)
  • This assignment of actual parameters to formal parameters when calling a subroutine is called parameter passing.

The way these variables of the main program are passed to the formal parameters of the subroutine is called passing type and is specified for each parameter in the interface of the subroutine.

There are three passing types:

  • Call by Value
  • Call by value and result
  • Call by reference