Array and Function

 ARRAY AND FUNCTIONS

function is a block of statements that performs a specific task. To pass an entire array to a function, only the name of the array is passed as an argument. 
Naturally, we pass array elements to the function in two ways:- call by value and call by reference. 
In Call by value, a copy of the variable is passed whereas in Call by reference, a variable itself is passed. In Call by value, actual and formal arguments will be created in different memory locations whereas in Call by reference, actual and formal arguments will be created in the same memory location.
As a rule of thumb, passing by reference or pointer is typically faster than passing by value, if the amount of data passed by value is larger than the size of a pointer.

Post a Comment

0 Comments