Write a program to illustrate the call by reference, C/C++ Programming

Assignment Help:

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;
}


Related Discussions:- Write a program to illustrate the call by reference

Encryption/Decryption, I need to include files so you can understand easier...

I need to include files so you can understand easier.

Explain quick sort and tree sort, Question 1 Explain Abstract data types w...

Question 1 Explain Abstract data types with its characteristics Question 2 Let us say your Learning Centre decides to store all the three types of student data Register

Program that allows a restaurant employee to enter an order, The Malt Shop ...

The Malt Shop restaurant charges $2.99 for burgers, $1.29 for fries, and $1.25 for sodas.  Write a program that allows a restaurant employee to enter an order (the number of bur

Miniumshelf, write a prgm to find minimum total number of shelves including...

write a prgm to find minimum total number of shelves including the intial one required for loading process

Write a program that takes the image, Write a program that takes the image ...

Write a program that takes the image tracks.jpg and finds Canny edges, and then finds lines in these edges using the Hough transform. The easiest way to do this is to take the prog

Stack, write c language program that shows stack overflow..

write c language program that shows stack overflow..

What is a union how does it differ from a structure, Question : (a) (i)...

Question : (a) (i) What is a structure member in C? What is the relationship between a structure member and the structure? (ii) How can structure variables be declared in C?

Write a program to find files-unix, This programming assignment is for use ...

This programming assignment is for use in the LINUX/UNIX environment!! Introduction: System administration often requires custom written programs and tools. One problem a s

Write Your Message!

Captcha
Free Assignment Quote

Assured A++ Grade

Get guaranteed satisfaction & time on delivery in every assignment order you paid with us! We ensure premium quality solution document along with free turntin report!

All rights reserved! Copyrights ©2019-2020 ExpertsMind IT Educational Pvt Ltd