Explain two methods of passing arguments to function with example.
Answers
Answered by
4
Call by value
Call by reference
Answered by
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
Chemistry,
6 months ago
Math,
6 months ago
Computer Science,
1 year ago
English,
1 year ago
Math,
1 year ago