Actual and Formal Parameters in QBASIC
In a modular programming, there should
be exchange of values between main module and sub modules. It is necessary to
pass the data from main module to sub modules for processing. For the same,
arguments and parameters are used.
Parameters:
Variables in a sub module or a
procedure declaration which accept data or variable passed to them from the
calling module are known as parameters. It is also known as formal parameters..
When we define a sub procedure, you specify a parameter list in parentheses
immediately following the procedure name. We can indicate that a parameter is
optional. It means that the calling code does not have to pass a value for it.
Types of Parameters
i) Actual
Parameter:
The parameters passed to the procedure are called actual
parameters. It is also known arguments.
ii) Formal
Parameters:
The parameters included in function/sub procedure
declaration are called formal parameters. It is also known as parameters.
Example:
Following points should be remembered while using actual
and formal parameters:
- The number of actual and formal parameters should be same.
- Parameters are matched according to their position and not according to their names.
- The data types of a matching pair of parameters must be the same.
No comments:
Post a Comment