A program to swap the two integer variable using call by value.
A program to swap the two integer variable using call by value.
Codes
/*A program to find the factorial of a number using recursive function*/
/*Programed by Jitendra Kr Yadav
10116
15 Mar,2011*/
#include<stdio.h>
#include<conio.h>
void swap(int,int);
main()
{
int a,b;
printf(“Enter the value of ‘a’ and ‘b’:\n”);
scanf(“%d%d”,&a,&b);
swap(a,b);
getch();
}
void swap(int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
printf(“a = %d\n”,x);
printf(“b = %d\n\n”,y);
printf(“Press any key to continue…”);
}
Output
Enter the value of ‘a’ and ‘b’:
6
5
a = 5
b = 6
Press any key to continue…