Tuesday, August 20, 2019

Swapping programs in Function.

Swapping programs in Function:


Swapping programs in Function:


#include<stdio.h>
#include<conio.h>
void swap(int x,int y);
void main()
{
int a=10,b=20;
clrscr();
swap(a,b);
printf("a=%d b=%d\n",a,b);
getch();
}
void swap(int x,int y)
{
int c,a,b;
c=x;
x=y;
y=c;
printf("x=%d y=%d\n",x,y);
}

Output:





EmoticonEmoticon