by Dinesh Thakur

This is C program where user asks to interchange the two values with each other using Call by reference method. Declaring the required variable for functionality. Then after user declare void swap() function that which will give the reference to other class for interchange. After that user call the function that declare void swap() then using method to interchange the value of variables with the help of pointer concept to declare pointer type variables that are useful while using the call by reference method. In the end the result has to be display on the screen.

Problem statement:

This is C program that asks the user to interchange the value of two variables with use of call by reference Method.

  1. Declaring variables.
  2. Make function.
  3. Calls the function.
  4. Using Interchange method for value swapping.
  5. Display result on the screen.

Here is C source code for interchange value of two variables using Call by reference Method. The output of this program shown below. 


void main()
     int a=40;
     int b=70;
     void swap(int *x,int *y);
     printf("\nAfter Swaping Result is :\na=%d  b=%d ",a,b);
     void swap(int *x,int *y)
              int t;

Interchange Values of 2 no: using Call By Reference