write a program to illustrate the call by


Write a Program to illustrate the Call by Reference?

Here is an illustration:

#include .

int compute_sum(int *n);
int main( void)
{
int n=3, sum;
printf("%d\n",n); /*3 is printed */
sum=compute_sum(&n);
printf("%d\n",n); /*3 is printed */
printf("%d\n",sum); /*6 is printed */
return 0;
}

int compute_sum(int *n) /*sum the integers from 1 to n*/ 9
{
int sum=0;
for (;*n>O;--*n) /*stored value of n is changed*/
sum+=*n;
return sum;
}

Request for Solution File

Ask an Expert for Answer!!
C/C++ Programming: write a program to illustrate the call by
Reference No:- TGS0304303

Expected delivery within 24 Hours