#include <stdio.h>
int add(int a, int b)//pass by value function
{
return a+b;
}
int addr(int *c,int *d)//pass by reference function
{
return( *c + *d );
}
int main()
{
//printf("Hello, World!\n");
int a,b;
printf("there sum is %d",add
(a
,b
)); //invoking pass by value
int *p; //creating a pointer to variable
p=&a;
*p=26;
printf("\nmodified value of a is %d",a
);
printf("\n using reference\n"); printf("%d",addr
(&a
,&b
)); //invoking pass by reference function
return 0;
}
I2luY2x1ZGUgPHN0ZGlvLmg+CmludCBhZGQoaW50IGEsIGludCBiKS8vcGFzcyBieSB2YWx1ZSBmdW5jdGlvbgp7CiAgICByZXR1cm4gYStiOwp9CgppbnQgYWRkcihpbnQgKmMsaW50ICpkKS8vcGFzcyBieSByZWZlcmVuY2UgZnVuY3Rpb24KewoJcmV0dXJuKCAqYyArICpkICk7Cn0KCmludCBtYWluKCkKewogICAgLy9wcmludGYoIkhlbGxvLCBXb3JsZCFcbiIpOwogICAgaW50IGEsYjsKICAgIHByaW50ZigiZW50ZXIgMiBkaWdpdHMiKTsKICAgIAogICAgc2NhbmYoIiVkJWQiLCAmYSwmYik7CiAgICBwcmludGYoInRoZXJlIHN1bSBpcyAlZCIsYWRkKGEsYikpOyAvL2ludm9raW5nIHBhc3MgYnkgdmFsdWUKICAgIAogICAgaW50ICpwOyAvL2NyZWF0aW5nIGEgcG9pbnRlciB0byB2YXJpYWJsZQogICAgcD0mYTsKICAgICpwPTI2OwogICAgCiAgICBwcmludGYoIlxubW9kaWZpZWQgdmFsdWUgb2YgYSBpcyAlZCIsYSk7CiAgIAogICAgcHJpbnRmKCJcbiB1c2luZyByZWZlcmVuY2VcbiIpOwogICAgcHJpbnRmKCIlZCIsYWRkcigmYSwmYikpOyAvL2ludm9raW5nIHBhc3MgYnkgcmVmZXJlbmNlIGZ1bmN0aW9uCgogICAgcmV0dXJuIDA7Cn0=