What are the different types of Arguments?

0 votes
94 views
Shikhar Arora asked 07-Dec-2019 in Technology by Shikhar Arora

What are the different types of Arguments

1 Answer

0 votes
Sangsaptak Pal answered 25-Jan-2020 by Sangsaptak Pal

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.