What are the different types of Arguments?

Asked 07-Dec-2019
Viewed 1135 times

1 Answer


0

Argument, in programming, is generally a value that is passed between programs, subroutines and functions. Arguments  are independent variables or items that contain data or codes.

Basically there are two types of arguments :

  • Formal arguments
  • Actual arguments

The variables that are declared in the function prototype or definition are known as formal arguments. The variables that are passed to the called function from the main function and are present in the calling statement are known as actual arguments.

What are the different types of Arguments?

Example image which demonstrates both the types.

Almost in all programming languages there are two types of calling:

  1. Call by value
  2. Call by reference

In call by value, a copy of the actual arguments which contain the values are passed to the formal parameters. Any change in the formal arguments do not change the actual arguments.

In call by reference, the address of the actual arguments is passed as arguments to the function. Any change in the formal arguments gets reflected in the actual arguments.