Program:
#include<stdio.h>
void exch(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
printf("Inside Function::\n");
printf("a=%d b=%d\n",*a,*b);
}
int main()
{
int x,y;
printf("Enter value of x and y: \n");
scanf("%d%d",&x,&y);
exch(&x,&y);
printf("From main Function::\n");
printf("x=%d y=%d\n",x,y);
return 0;
}
Output:
#include<stdio.h>
void exch(int *a,int *b)
{
int temp;
temp=*a;
*a=*b;
*b=temp;
printf("Inside Function::\n");
printf("a=%d b=%d\n",*a,*b);
}
int main()
{
int x,y;
printf("Enter value of x and y: \n");
scanf("%d%d",&x,&y);
exch(&x,&y);
printf("From main Function::\n");
printf("x=%d y=%d\n",x,y);
return 0;
}
No comments:
Post a Comment