C Programming language

adplus-dvertising
C Program example: Call Function by reference
Previous Home Next
Program that call a function by reference
/** Program that call a function by reference **/

#include<stdio.h>
#include<conio.h>
void main()
{
	int a=34,b=12;
	void addab(int *x,int *y);
	clrscr();
	printf("\nBefore function call a=%d,b=%d",a,b);
	addab(&a,&b);
	printf("\n\nAfter function calla=%d,b=%d",a,b);
	getch();
}
void addab(int *x,int *y)
{
	*x=*x+10;
	*y=*y+10;
	printf("\n\ninside the functiona=%d,b=%d",x,y);
}
Output :

Before Function call 34 12

Inside the function -12 -14

After function call 44

Previous Home Next