answersLogoWhite

0

When do you use call by reference?

User Avatar

Anonymous

16y ago
Updated: 8/17/2019

You cannot do that in C, but you can pass pointers to objects, like this:

void swap (int *a, int *b)

{

int tmp=*a; *a=*b; *b= tmp;

}

int x=3, y=4;

swap (&x, &y);

User Avatar

Wiki User

16y ago

What else can I help you with?

Related Questions

What do ISDN devices use a call reference value for?

To identify a specific call


Object are passed to a method by use of a call -by- reference?

yes


Does java support call by reference?

No , Java does not support call by reference.


Is call by reference supported by pointer?

No, call-by-reference can be emulated with pointers.


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

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


What is a reference variable in c plus plus?

A reference variable in C++ is a formal parameter of a function call that automatically dereferences itself, as if it were a pointer, into a reference to the original value in the calling routine. You declare the reference type in the function declaration and prototype, but the compiler automatically adds the reference (&) operator on call, and the dereference (*) operator on use.


Who do I call about a grant?

I would call your local reference librarian. Call your library and ask for the reference desk. You will get at least some starting helpers.


Can you swap two numbers by call by reference outside the function?

The using of term 'call-by-reference' implies function-call, so please rethink your question...


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 do you call a person who provides a reference?

A person who provides a reference is often referred to as a referee.


How do you use call by reference in c plus plus?

Call by reference means calling a function using a reference to a variable or a pointer. You call a function by passing refrences to a variable. For eg: void x(int &a) { a=2; } void main() { int s=3; x(s); } OR void a(int &c) { c=5;}void main(){ int *p; *p=2a(*p);}


Call by reference?

A very useful thing.