Computer for SEE and NEB

It is a complete SEE and NEB solution for computer science. It includes Computer Fundamentals, Database (SQL), Programming in C QBASIC, CSS, JavaScript, and PHP for beginners.

Breaking

Post Top Ad

Your Ad Spot

Sunday, March 6, 2022

Actual and formal parameters in modular programming of QBASIC for class 10 and SEE

 

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:

 

 Note: In above example “add” is the procedure name, where “a” and “b” are two formal parameters and  “x” and “y” are two actual parameters. Value of “x” is passed to “a” and value of “y” is passed to “b”.

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

Post Top Ad

Your Ad Spot

Pages