Call by Reference in C Function

Last Updated Nov 20, 2015, 07:00:14 PM





Call by Reference mechanism copies the actual address of argument into the formal parameter. In this case, address location can be used to call the argument. Unlike, call by value any changes made to the formal parameters does effect the actual parameter
call by reference in c functions

Example

Try It Now

Difference between call by value and call by reference

call by value

When you pass a parameter by value, it just copies the value within the function parameter and whatever is done with that variable within the function doesn't reflect the original variable

call by reference

when we send the parameters by reference, it copies the address of the variable which means whatever we do with the variables within the function, is actually done at the original memory location



Some interesting online threads about this topic, it might help you learn more

Call by reference, value, and name? - StackOverFlow

Difference Between Call By Reference And Call By Pointer? - StackOverFlow

Other function Topics you might want to learn

functions in c

Call by Value