Computer Science, asked by Sharmagaurav3981, 1 year ago

Explain two methods of passing arguments to function with example.

Answers

Answered by Anonymous
4

Call by value

Call by reference

Answered by monica789412
4

The two methods of passing arguments to function are call by value and call be reference.

Call by value:

  • When a function is called by value, the actual values to be processed are passed to the calling function.
  • With this technique, an argument's value is copied into the function's formal parameters.
  • To pass arguments, the C programming language by default employs the call by value mechanism.

Call by reference :

  • When a function is called by reference, the calling function calls the function and passes the address of the real values to be processed.
  • This method copies an argument's address into the parameter.
  • The address is utilised inside the subroutine to obtain the call's real argument.

#SPJ3

Similar questions