Sprint * 100%-+ 10:02 AM a instructure-uploads.s3.amazonaws.com 1. Call-By-Reference Functions Sometimes we may want to retum more than one value from a function The ?@turn statement can only be used to return one value. Istead, we will use the call-by-reference mechanism to update the arguments that are' passed to function. Following is an example in which we have used this method toreturn a value to main without using the Eeturn statement. A call-by-reference parameter is marked by the so that the compler will distinguish it from other parameters. Suppose, you wanted to ca??? function that would ask users to arput the floating-point numbers. a. b, and G. You could have called a function at get a bcla,b,) Now, the declaration of this function (using call-by-reference) will look lsike this: void get a bc(floats a, floats b, float&c) is worth noting that one may think that the use of 4 in all function calls sounds like a good idea. The argument one may make is that "it is safe to use it all the time, so when the value needs to get updated, it is already there. However, passing a variable using call-by reference may resut in unwanted and undesirable changes in the value, which may cause the program to produce incorrect results. As a rule, you need to keep all parameters as cal-by-value and only change those to cal by-reference that you need to get updated Let's look at a program and see how this works In the following example, the get input function obtains two values from the user, then returms for bring) them to the main function. In a sense, get input "returms" two values. This cannot be done with the return statement because the return statement retures exactly one value. If a function must produce more than one output value, then we must use call-by-reference parameters (one for each output value) include diostream uning namespace std Declaration of function that reads the values for i andj nt maing nt & eet inpul,i cout ex"About to call function process:i eciee"-ecje end /Call function process to increase i by 20 and decrease j by 20 process 20 return 0 n 30i ou e end Sprint * 100%-+ 10:02 AM a instructure-uploads.s3.amazonaws.com 1. Call-By-Reference Functions Sometimes we may want to retum more than one value from a function The ?@turn statement can only be used to return one value. Istead, we will use the call-by-reference mechanism to update the arguments that are' passed to function. Following is an example in which we have used this method toreturn a value to main without using the Eeturn statement. A call-by-reference parameter is marked by the so that the compler will distinguish it from other parameters. Suppose, you wanted to ca??? function that would ask users to arput the floating-point numbers. a. b, and G. You could have called a function at get a bcla,b,) Now, the declaration of this function (using call-by-reference) will look lsike this: void get a bc(floats a, floats b, float&c) is worth noting that one may think that the use of 4 in all function calls sounds like a good idea. The argument one may make is that "it is safe to use it all the time, so when the value needs to get updated, it is already there. However, passing a variable using call-by reference may resut in unwanted and undesirable changes in the value, which may cause the program to produce incorrect results. As a rule, you need to keep all parameters as cal-by-value and only change those to cal by-reference that you need to get updated Let's look at a program and see how this works In the following example, the get input function obtains two values from the user, then returms for bring) them to the main function. In a sense, get input "returms" two values. This cannot be done with the return statement because the return statement retures exactly one value. If a function must produce more than one output value, then we must use call-by-reference parameters (one for each output value) include diostream uning namespace std Declaration of function that reads the values for i andj nt maing nt & eet inpul,i cout ex"About to call function process:i eciee"-ecje end /Call function process to increase i by 20 and decrease j by 20 process 20 return 0 n 30i ou e end