C Programming Language Tutorial 37 Difference between Call by Value and Call by Reference

Published: 14 January 2015
on channel: Champion Mahipal
3,999
7

This video is made to learn about Difference between Call by Value and Call by Reference in C Programming Language.

This is made by Swap function.

Call by Value : If we call a function in C by passing values of variables as the parameters/arguments to the function then such type of function call is known as Call by value.
Call by Reference : We know that whatever variable we are using in our program, ultimately it is getting stored somewhere in memory. So instead of passing values of variables as parameters to the function, if we pass address of those variables and somehow able to access data contained inside those addresses then we will be able to call functions.
Interestingly, concepts of Pointers provide us the advantage of manipulating addresses.So calling a function by passing addresses of variables as the parameters to the function is known as Call by Reference.

Arguments passed to the function during function call are known as actual arguments and the arguments we use during a function definition are known as formal arguments. For a function call to be valid the type, order and number of actual and formal arguments must always be same.

During call by value method the ‘value’ of each of the actual arguments in the calling function is copied into corresponding formal arguments of the called function. In this method, the changes made to the formal arguments in the called function have no effect on the values of actual arguments in the calling function.


On this page of the site you can watch the video online C Programming Language Tutorial 37 Difference between Call by Value and Call by Reference with a duration of hours minute second in good quality, which was uploaded by the user Champion Mahipal 14 January 2015, share the link with friends and acquaintances, this video has already been watched 3,999 times on youtube and it was liked by 7 viewers. Enjoy your viewing!