Call By Value in C

/* Program for inerchanging two numbers demonstrating Call By Value in C */

#include< stdio.h>
#include< conio.h>

void swap(int *,int *);

void main()
{
int x,y;
x=15;y=20;
clrscr();
printf("x=%d,y=%d\n",x,y);
swap(&x;,&y;);
//printf("\n%x %x",&x;,&y;);
printf("\n after interchanging x=%d,y=%d\n",x,y);
getch();
}

void swap(int *u,int *v)
{
int temp;
temp=*u;
*u=*v;
*v=temp;

return;
}
Comments
Advertisements
Zimbio Entertainment
Copyright © 2012 - Zimbio, Inc. Some rights reserved. Coming soon: Livingly
Share
. . .
Follow
. . .