F How to do swap values between two variables using call by value method in C ? | CodeTheta

How to do swap values between two variables using call by value method in C ?

January 17, 2014


/* http://native-code.blogspot.com */

#include<stdio.h>
#include<conio.h>
void f1(int i1,int j1)
{
int t;
t=i1;
i1=j1;
j1=t;
printf("/* http://native-code.blogspot.com */\n\nin funtion after swaping i=%d  j=%d",i1,j1);
}
void main()
{
int i,j;
int t;
i=10;
j=20;
f1(i,j);// function call

printf("\n after swap i=%d",i);
printf("\n after swap j=%d",j);

getch();
}

/* http://native-code.blogspot.com */

Post a Comment