answersLogoWhite

0


Best Answer

If you need to pass an array with the large number of elements the best way to do it is using passing by reference because you don't create a copy of the array. Thus, you save free RAM space.

User Avatar

Wiki User

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Give an example where passing an argument by reference would be useful?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Continue Learning about Engineering

Call by reference in c?

If you are calling by reference it means that compilator will not create a local copy of the variable which you are referencing to. It will get access to the memory where the variable saved. When you are doing any operations with a referenced variable you can change the value of the variable.It is a technique whereby the called function receives values from its calling function, stores these values in its local arguments and returns a result. The called function does not have access to any local variables in the calling function. Anything passed into the function call is unchanged in the caller's scope when the function returns.No, C uses call-by-value. Of course you may use pointers as parameters.


What is difference between call by value and pass by value?

When you pass by value, the function's parameter is assigned the value of the argument that was passed. When you pass by reference, the function's reference parameter is assigned the address of the argument. In other words, pass by value copies the value, pass by reference passes the variable itself.Pass by reference is always the preferred method of passing arguments to functions when those arguments are complex objects. If the argument is a primitive data type then the cost in copying the value is minimal, but copying a complex object is expensive in terms of performance and memory consumption. If the function parameter is declare constant, you can be assured the object's immutable members will not be affected by the function. If it is non-constant and you do not wish your object to be altered, you can either copy the object and pass the copy, or pass the object by value if the function is overloaded to cater for this eventuality (good code will provide both options).


Why is parameter passing useful to programmers?

Because all software is written using functions and classes. If you do not know how to pass data from class to class, to function you are not a programmer.


How can you create something useful from waste?

There are all kinds of waste that can be turned into something useful. For example, with a little imagination, old tires can be used to make an ottoman.


How do you write a sentence with the word usefully?

ther is no such word as "usefully" that would be terrible grammar, try "useful" that way you could write a sentence for example:: " it is useful to use a dictionary when writing a letter".

Related questions

When spotted fallacies can be useful in?

B. Damaging an opponents argument


Call by reference?

A very useful thing.


Call by reference in c?

If you are calling by reference it means that compilator will not create a local copy of the variable which you are referencing to. It will get access to the memory where the variable saved. When you are doing any operations with a referenced variable you can change the value of the variable.It is a technique whereby the called function receives values from its calling function, stores these values in its local arguments and returns a result. The called function does not have access to any local variables in the calling function. Anything passed into the function call is unchanged in the caller's scope when the function returns.No, C uses call-by-value. Of course you may use pointers as parameters.


How many constellations useful to people?

9 constellations are useful to man, they are useful in showing directions with reference to Pole star.


What would a reference manual be useful for?

it is used for reading


Why is anticipation a useful persuasive technique?

It helps you to prepare your response to an argument in advance.


Are constellation patterns useful in modern astronomy?

Yes. Landmarks or skymarks are useful for reference points for locations.


What are useful reference points?

Reference points are used in order to easily access information that is in a larger collection of data.


What is difference between call by value and pass by value?

When you pass by value, the function's parameter is assigned the value of the argument that was passed. When you pass by reference, the function's reference parameter is assigned the address of the argument. In other words, pass by value copies the value, pass by reference passes the variable itself.Pass by reference is always the preferred method of passing arguments to functions when those arguments are complex objects. If the argument is a primitive data type then the cost in copying the value is minimal, but copying a complex object is expensive in terms of performance and memory consumption. If the function parameter is declare constant, you can be assured the object's immutable members will not be affected by the function. If it is non-constant and you do not wish your object to be altered, you can either copy the object and pass the copy, or pass the object by value if the function is overloaded to cater for this eventuality (good code will provide both options).


When is it useful not useful to heat materials?

If you are stuck with metal for example you can heat it


What property of gold makes it useful in computer parts?

to serve as a standard conductor in passing electricity


List two similarities between a criterion reference test and norm referenced test?

Norma Reference Measurement and Reference Measurement Criteria generally is the most useful frame of reference to describe the level of knowledge and performance of students.