0
1000views
Explain the Difference between formal and actual parameters with an example.
1 Answer
0
76views

Solution:

Actual Parameters:

Actual parameters are values that are passed to a function when it is invoked. Refer to the below program.

enter image description here

Formal parameter:

A formal parameter is defined while determining the subroutine. Formal parameters are also used in the header of the function.

Formal parameters are always variables, while actual parameters do not have to be variables.

The syntax of the formal parameters is:

**<def keyword> <method name> (formal parameters): # set of statements to be executed**
Actual Parameters Formal Parameters
When a function is called, the values (expressions) given in the function call are referred to as the arguments or actual parameters Formal parameters are those used in function definition statements that contain data types at the time of declaration
It is not necessary to mention the data type in the actual argument The receiving value's data type must be specified
Passed on calling a function They will be in the called function.
The parameters specified in a function call are referred to as real parameters Formal parameters are the parameters that are written in the function definition
Data types will not be mentioned. The data type must be included.
Please log in to add an answer.