define function and their purpose ? compare between call by value and call by references . *
Answers
Answer:
(PLEASE MARK BRAINLIEST)
Explanation:
Function is an activity that is natural to or the purpose of a person or thing.
A function relates an input to an output. It is like a machine that has an input and an output. And the output is related somehow to the input. "f(x) = ... " is the classic way of writing a function.
There are two ways to pass arguments/parameters to function calls -- call by value and call by reference. The major difference between call by value and call by reference is that in call by value a copy of actual arguments is passed to respective formal arguments. While, in call by reference the location (address) of actual arguments is passed to formal arguments, hence any change made to formal arguments will also reflect in actual arguments.
Answer:
While calling a function, when you pass values by copying variables, it is known as "Call By Values." While calling a function, in programming language instead of copying the values of variables, the address of the variables is used it is known as "Call By References. In this method, a copy of the variable is passed.