Reference

2
 /*write a program of call by reference*/ #include<stdio.h> #include<conio.h> void main() { void swap(int*a, int*b); int a,b; printf(“enter an two numbers!); scanf(“"d"d!,a,b); printf(“before swappin$ a%"d,b%"d!,a,b); swap(a,b); printf(“after swappin$ a %"d, b%"d!,a,b); $etch(); & void swap(int*',in t*) { int ; %*'; *'%*; *%*; & OUTPUT enter an two numbers before swappin$ a% b% after swappin$ a% b%

description

fd

Transcript of Reference

/*write a program of call by reference*/#include#includevoid main(){void swap(int*a,int*b);int a,b;printf(enter any two numbers);scanf(%d%d,&a,&b);printf(before swapping a=%d,b=%d,a,b);swap(&a,&b);printf(after swapping a =%d, b=%d,a,b);getch();}void swap(int*x,int*y){int z;z=*x;*x=*y;*y=*z;}OUTPUTenter any two numbers 6 7before swapping a=6 b=7after swapping a=7 b=6