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

Matrix transposition cipher, write a C rpogram that can display the transpo...

write a C rpogram that can display the transpose form of a ciphertext matrix.Prompt users to provide row and coloumn number of matrix.Then user will input plaintext and the program

Integration, to find the area under the curve y = f(x) between x = a and x ...

to find the area under the curve y = f(x) between x = a and x = b

How many non-letters are included in the string, Write a fully modular C pr...

Write a fully modular C program that reads in a string of a defined size from the keyboard and reports how many times each letter of the alphabet occurs within that string (ignorin

Define the processing of a structure, Define the Processing of a Structure?...

Define the Processing of a Structure? The members of structure are typically processed individually as separate entities. So we must be able to access the individual structure

Define statements to define the constants, the problem description. The ...

the problem description. The order of the C Program should be as follows: Variables and constants Use #define statements to define the constants. Use arr

Queue, write a queue program in c langauge?

write a queue program in c langauge?

What is the difference between structure and class, What is the difference ...

What is the difference between structure and class? - Members of structures are public while those of a class are private. - Classes provide data hiding while structures don

Programming an odds betting website, Programming an odds betting website ...

Programming an odds betting website Project Description: We want someone to program a odds betting website, Require someone with experience and skills! Skills required are

ASCII, A string S is said to be "Super ASCII", if it contains the character...

A string S is said to be "Super ASCII", if it contains the character frequency equal to their ascii values. String will contain only lower case alphabets (''a''-''z'') and the asci

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