Sunday, July 31, 2016

Average Program Through Value -Call By Value

Average Program Through Value -Call By Value

#include<stdio.h>
#include<conio.h>
void main()
{
int a,b;
void valueswap(int,int);
clrscr();
printf("Enter YourTwo Values for Swaping::");
printf("\nEnter Your 1st No.::");
scanf("%d",&a);
printf("Enter Your 2nd No.::");
scanf("%d",&b);
valueswap(a,b);
getch();
}
void valueswap( int x,int y)
{
int temp;
temp=x;
x=y;
y=temp;
printf("\n\n Call By value\n\n");
printf("The swapped values are \n a=%d \n b=%d",x,y);
}
/*
Output:

Enter Your Two Values for Swapping::
Enter Your 1st No.::34
Enter Your 2nd No.::45

Call By value

The swaped values are
a=45
b=34

*/

No comments:

Post a Comment