 Hello friends, I am Sanjay Gupta. I welcome you on the channel. You can watch various programming related videos on my YouTube channel. It contains more than 800 videos. You can search these videos with the help of this keyword programming by Sanjay Gupta. In this video, I am going to demonstrate you how you can pass addresses of variables into functions in C programming. For demonstration purpose, I am going to use the example of swapping using call by address method. First of all, I am going to include a header file stdi.h. Now I am going to declare a function whose name is swap. It will be receiving two arguments and I am going to pass addresses. That's why I have used int asterisk comma int asterisk. So whenever you want to pass addresses of variables, those addresses will be processed with help of pointers. So to declare pointers, I have used these data types in this declaration. Now I am going to define main function. Inside main function, I have declared two variables a and b. This printf will be displaying the message enter two values and the entered values will be stored inside these a and b variables with the help of this scanner function. So this way printf and scanner will be reading the values from user. Now I am going to call swap and I am passing addresses of a and b variables here. So this is calling a function and you can see I am passing addresses of a and b variables here and then I am going to print values of these variables after completion of function definition process. Now after defining this main function, I am going to define swap function. So this block will be known as definition of this swap function. Inside this definition, I am going to process values of a and b with the help of these pointers. So whenever you want to pass address of variables, you have to receive those addresses into the pointers. So here p is receiving address of a and q is receiving address of b. So if you want to access value of a and b, you can use these pointers. So here I am going to write the logic for swapping. I am using temporary variable t. So this is the logic for swapping. I have used temporary variable t and asterisk p and asterisk q. So whenever I am writing asterisk p, it is dereferencing the address which is available inside this p pointer which is address of a. So it means if I am writing asterisk p, it means I am accessing the value of a and if I am writing asterisk q, it means I am accessing the value of b and whenever you modify a pointer, it means you are modifying the variable whose address is available inside the pointer. So I am changing p and q but indirectly values of a and b will be swapped and those swapped values will be displayed on output screen with the help of line number 11. So here I have not returned any particular value but still changes will reflect in main function where I have called the function. Now I am going to execute this code so that you can understand whether it is working properly or not. So I am entering two numbers 10 and 20. You can see the output a equals to 20 and b equals to 10. So I entered 10 in a and 20 in b but after swapping values are interchanged and data is correct which are available on output screen. So this way I have passed arguments addresses into the function and those addresses are processed with help of pointers in C programming. So I hope you have understood how we can pass addresses of variables into functions in C programming. I hope you have understood whatever I have explained in this video. If you want to watch more programming related videos you can follow my YouTube channel. Thank you for watching this video.