Get Even More Visitors To Your Blog, Upgrade To A Business Listing >>

Difference between Formal Parameters and Actual Parameters

A parameter is a piece of data passed to a Function. If a function uses arguments then the variables must be declared in the header of function definition to receive the values. There are two types of arguments/ parameters:

  1. Formal Parameters
  2. Actual Parameters

Formal Parameters

The parameters used in the header of function definition are called formal parameters of the function. These parameters are used to receive values from the calling function.

Actual Parameters

The parameters used in the function call are called Actual Parameters. These are the actual values that are passed to the function. The actual parameters may be in the form of constant values or variables. The data types of actual parameters must match with the corresponding data types of formal parameters (variables) in the function definition.

Difference between Formal and Actual Parameters / Arguments

Formal Parameters Actual Parameters
They are used in the function header. They are used in the function call
They are used to receive the values that are passed to the function through function call. They are actual values that are passed to the function definition through the function call.
They are treated as local variables of a function in which they are used in the function header. They can be constant values or variable names (such as local or global).


This post first appeared on Programming Explain, please read the originial post: here

Share the post

Difference between Formal Parameters and Actual Parameters

×

Subscribe to Programming Explain

Get updates delivered right to your inbox!

Thank you for your subscription

×