Articles added in Mathematics Lab | Cyber Lab is now open | Astronomy Lab is now open | VLSI Lab is now open | 120 SEO Tips article published | More exciting articles coming soon!




Call by value and call by reference

When a function is called, the parameters can be passed in two ways:

1) call by value: values of actual parameters will be given to corresponding formal parameters. The changes made in the formal parameters, when the function executes, will not be reflected into the corresponding actual parameters.
In program 3.15 value of “m” will be given to “n”. After execution, “n” becomes 0 but “m” remains the same.

2) call by reference: addresses of actual parameters are given to corresponding formal parameters (formal parameters are pointers). The changes made in formal parameters during function execution can be reflected into corresponding actual parameters.
In program 3.15, address of sum is given to s and changes made in *s is directly reflecting in sum, therefore they share same memory location.







CACKLE comment system





Programming Resources
Computer Networking Fundamentals Android Application