#include <stdio.h>
void swap_by_value(int*num1,int*num2)
{
int temp;
temp=*num1;
*num1=*num2;
*num2=temp;
temp=*num1;
*num1=*num2;
*num2=temp;
}
int main()
{
int a,b;
a=7,b=11;
printf("before swapping\n\n");
printf("a=%d\t b=%d\n",a,b);
printf("\n\n after swapping\n\n");
swap_by_value(&a,&b);
printf("a=%d\t b=%d\n",b,a);
return 0;
}
To embed this project on your website, copy the following code and paste it into your website's HTML: