answersLogoWhite

0

Why do you sometimes need to pass arguments to functions by reference?

Updated: 8/21/2019
User Avatar

RichardIsaacsgp7883

Lvl 1
10y ago

Best Answer

You should always pass by reference unless there is good reason not to. Passing by reference always passes the object itself whereas passing by value always copies the object. Copying complex objects can severely impact upon performance which is why programmers try very hard to never pass anything larger than the CPU can cope with (typically 4 bytes on a 32-bit system and 8 bytes on a 64-bit system).

Since a reference is effectively the address of an object and has the same length as a pointer, you can pass by reference either by passing a pointer or by passing an actual reference, depending on the function signature. The difference is that when you pass a pointer, the pointer is actually passed by value and is therefore copied. Also, pointers must also be dereferenced which incurs an extra layer of indirection that you do not incur when passing by reference. When you pass by reference you pass the object itself.

User Avatar

Wiki User

10y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Why do you sometimes need to pass arguments to functions by reference?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What are arguments in MS Excel?

Arguments are the values that are entered into functions to enable them to work. Most functions require arguments. For example, if you want to find out what day of the week a date is, you need a function called Weekday and the date that you want as the argument of the function.


Why is it that the TODAY and NOW date functions do not have any arguments?

Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.Some functions need additional information to work, like SUM needing values to add. Some functions don't need anything to work. TODAY and NOW can both get what they need from the system clock on your computer, so they do not need the user to specify any arguments for them to work.


Where do you find a list of Excel arguments?

Each function in Excel that has arguments will differ in terms of what arguments are needed. The help for a particular function will indicate what arguments may be needed. Some functions can be used in different ways and may not always need all arguments.


What does this mean in Excel more arguments have been specified for this function than are allowed in the current file format?

What you put inside the brackets of a function are known as arguments. Some functions need a specific amount of arguments to work. If you put too many or too few, the function will not work. Other functions have optional arguments or are less specific about how many they need, so they do not give those kinds of errors. The version or type of file may also affect the functions, as some versions do not have the same functions and so they may not work or may work differently.


Do all functions have arguments?

Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.Some functions do and some don't. So it depends on which function you use. Some need more information, like ones that are calculating something like SUM or AVERAGE. Others do not need any arguments like the TODAY function which gives the current date on the computer. So for each function you need to check how to use it and as part of that you will have to find out if it uses arguments and the type and amount of arguments it uses.


One component of an Excel function is the argument. What is an argument?

In Excel, an argument is a value that is passed to a function in order for it to carry out its task. So for a SUM function, it needs to know what values to add up. This means giving the SUM functions cell references or actual values to use in its calculations. Most functions require arguments, though some don't.Here A1:A15 is the argument:=SUM(A1:A15)Here is an IF function with 3 arguments, as it needs a condition, an action if the condition is true and an action if the condition is false:=IF(A3>=40,"Pass","Fail")Arguments are the elements that are required by some functions in order to operate. To carry out their calculations they need certain information or figures to work on. Some functions have lots of required arguments and can be quite complicated. The arguments of the function are contained in the brackets of the function. For example, the A5:A10 here is the arguments for the function, telling the Sum function what cell range it is going to add.=Sum(A5:B10)All functions have brackets, though not all need to have arguments in the brackets. For example, this functions gives you the current date and time, and it doesn't require any arguments:=Now()


Which is the best book to start learning the C programming language?

Rather than a book, try googling for C TUTORIAL. Also you will need a good function reference. Peruse the function reference. It is impossible to know all the functions, all of the parameters that the various functions need. The key is to know where to find the information.


What is a argument in Microsoft Excel?

An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.An argument is the name for something used in a function in order for it to work. A SUM function needs something to sum, so you provide that. That is an argument. Most functions require arguments to work, though there are some, like TODAY() that don't need any arguments.


What is the value that determines how an Excel function should be used?

A function will have a name, brackets and inside the brackets certain values will be needed, depending on the function. Some functions, like NOW(), do not need anything inside the brackets. Most functions have a set number of values needed in the function, and many have ones that are optional.


What is a general syntax of all formulas in Excel?

You start with the equals sign. After that there is no fixed rule, as formulas are completely different to each other. If you are using functions then there are some rules. First there is the name of the function. After that you have an opening round bracket. Most functions will have arguments in them, and some will not. The square brackets used below indicate that there may or may not be arguments, but are not part of the function. If there are any arguments, they need to be put inside the round brackets. Finally there will be the closing round bracket.=function_name([arguments])This is how the SUM function can work:=SUM(A2:A20)You can also have formulas with no functions. They would include values and cell references:=20+C5-34*4


What are the types to pass a structure to functions?

A structure is a type so you just need to pass the structure as you would any other data type: by reference or by value.


Is it true that functions take in values of the independent variable?

Sometimes. There need not be any independent variable - if the variables are all intercorrelated through feedback.