Wednesday, 26 July 2017

C program for Swap using Function Call By Reference

C program for Swap using Function Call By Reference.

C program to swap two numbers with and with out the usage of 0.33 variable, swapping in c using guidelines, capabilities (call through reference) and using bitwise XOR operator, swapping manner interchanging. For instance if for your c program you have got taken two variable a and b in which a = 4 and b = 5, then earlier than swapping a = 4, b = 5 after swapping a = 5, b = 4

What is Call By Reference?

The Call By Reference method of passing arguments to a function copies the reference of an argument into the formal parameter. Inside the function, the reference is used to access the actual argument used in the call. This means that changes made to the parameter affect the passed argument.


int swap(int*,int*);
void main()
int i=10,j=20;
printf("Before Swaping i=%d j=%d");
printf("\nAfter Swaping i=%d j=%d\n",i,j);
int swap(int *i,int *j)
int temp;
return temp;


Try it yourself.
If you have any problem you can tell me on comment box i will help you.

Viral Programs

Lorem ipsum dolor sit amet, consectetur adipisicing elit, sed do eiusmod tempor incididunt ut labore et dolore magna aliqua. Ut enim ad minim veniam, quis nostrud exercitation.


Post a Comment