Swapping of Two Values (By Value)

Program 4: Swapping of Two Values (Call by Value)


#include<stdio.h>
#include<conio.h>
void main()
{
 int a,b,c;
 printf("Enter first & second value");
 scanf("%d%d",&a,&b);
 printf("Both values are:\n %d%d",a,b);
 swapv(a,b);
 getch();
}

swapv(int x,int y)
{
 int t;
 t=x;
 x=y;
 y=t;
 printf("\nAfter swapping values are \n %d%d",x,y);
 return 0;
}

Post a Comment

Previous Post Next Post