Header Ads Widget

program to swap the value by call by refrence..

#include<stdio.h>
int swap(int*,int*); //functon decleretion
void main()
{
int a,b;
clrscr();
printf("Enter two values");
scanf("%d%d",&a,&b);
swap(&a,&b);
printf("%d %d",a,b);
getch();
}
// function definition swap
int swap(int *p,int *q)
{
int t;
t=*p;
*p=*q;
*q=t;
}

Post a Comment

1 Comments