answersLogoWhite

0


Best Answer

A function can only return one value, but it can modify its parameters if their type is 'in out' or 'out'.

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How many values you can return by call by value and call by reference at a time?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What does c plus plus use call by value or call by reference?

When we call a function in C++ by passing the values as arguments, it is called call by value. e.g #include<iostream.h> #include<conio.h> int add(int,int); int main() { int a,b,c; cout<<"Enter numbers."; cin>>a>>b; c=add(a,b); cout<<"Sum : "<<c; return 0; } int add(int a,int b) { int c; c=a+b; return c; }


What is the difference in function calling by value and calling by reference?

Call by Value:- In this method a copy of the variables is created and is updated time to time but not the actual memory location is updated.so when we make a call to the function we get old valuesCall by Reference:- In this method we access the variable by the reference of the memory location,so when we make call to the variable we get the updated values.


How do you combine call by value and call by reference programs in c?

Very easily: there is no call-by-reference in C.


Swap two numbers using call by value and call by reference?

You cannot swap two numbers using call by value, because the called function does not have access to the original copy of the numbers.Swap with call by reference... This routine uses exclusive or swap without temporary variable.void swap (int *a, int *b) {*a ^= *b;*b ^= *a;*a ^= *b;return;}


Explain the passing parameters as function in Call by Value and Call by Reference and then distinguish between them?

Call by value essentially passes a copy of an object's value whereas call by reference essentially passes the object itself. Pass by reference is the preferred method whenever possible as call by value will automatically invoke the object's copy constructor, which is often unnecessary, especially if the object is not affected by the function call (pass by constant reference).


What is a call value?

While calling a function, if the arguments supplied are the original values it is called call by value. e.g. int sum(int a, int b) { return (a+b); } int main() { int a=10; int b=20; printf("Sum is %d",sum(a,b)); return 1; }


What do you call an unchanging value in a formula in excel?

It can be called a constant or fixed value. If it is not a value but a cell reference then it can be called an absolute reference.


What is Parameter Passing and Returning values.. in Programming.. preferbly Visual Basic?

Parameters are the variables you pass to functions. Return values are the variables that are returned by those functions. Values can also be returned by the parameters themselves (such parameters are said to be output parameters).The variables you pass and return from functions will either be by value or by reference. Only references can be output parameters, since passing by value creates an automatic copy of the value which falls from scope when the function returns. Pointer variables are always passed by value. To pass a reference to a pointer you must pass a pointer to the pointer, which is itself passed by value, but refers to the pointer.Constant references are the preferred method of passing variables to functions, since there is no need to copy the variable you pass and because it is constant, the original value is left unaltered. Non-constant reference is the next best method, but only if you expect changes to be reflected back in your value (an output parameter). If you do not expect changes, then you must pass by value or, when that isn't an option, create a copy of your value and pass by non-constant reference. The only difference is that passing by value automatically destroys the copy when the function returns.Ignoring output parameters, a function can only return, at most, one value. A function that returns void has no return value, however it is good practice to always return something, even if only an integer to indicate whether the function was successful (zero) or not (non-zero). If the function is a logical function, such as Add( X, Y ), or an accessor, such as GetName() then it makes more sense to return the actual result of the function via the return value. If you need more than one return value, then you must use output parameters, passed by reference, which allows the return value to be used as an error indicator.Generally you will want to store the return value of a function, especially if the return value is a memory allocation. If you don't store the return value, the value is lost forever, unless you re-call the function with the same parameters, which is highly inefficient. However, if you only need to know the result of a function once, you don't need to store it, so long as you act upon it immediately, usually as part of a conditional expression. E.g.,int x, y; // Uninitialised, values unknown.if( x + y == 12 ) // call the int::operator+ function.// x+y is definitely 12.else// x+y is definitely not 12, but the actual sum is no longer known at this point.


How can you change values in call by reference?

We don't call by reference, we call functions. The arguments passed to the function are passed (not called) either by value or by reference, depending upon the function signature (the prototype). When you pass by reference you are passing the actual variable, not a copy of the variable, thus the function can modify that variable's value directly. The only exception is when the parameter is declared a constant reference. Passing a pointer is essentially the same as passing by reference, however the pointer itself is passed by value. To pass a pointer by reference you must pass a pointer-to-pointer instead. Passing by value always copies the value, whether it is declared constant or not. But if it is declared constant, the function might as well accept a constant reference. Passing objects (instances of a class) by constant value will incur a performance penalty in making an unnecessary copy. If it is constant, there is little point in copying the object.


Wap to interchange values of two variabkes by implementing call by value and call by reference method?

You cannot swap values via pass by value since the values would be copies of the original values, therefore only the copies would be swapped. You have to use pass by value, either by reference or by pointer. References are easier to implement: void swap(int& x,int& y){x^=y^=x^=y;} Using pointers: void swap(int* const x,int* const y){ assert(x && y); // null pointers not permitted! (*x)^=(*y)^=(*x)^=(*y);}


What do ISDN devices use a call reference value for?

To identify a specific call


What are the advantages of pass by reference as compared to pass by value?

Call by reference, particularly when applied to objects, because call by value automatically invokes an object's copy constructor, which is seldom desirable when passing objects into functions.