IT  Consultants :: I.T. Outsourcing @ Peace of Mind   
Select a Consultancy Service:
Go
Custom Web Design Service Article repository

Informative articles on software development, web development, SEO and website design services

Home » Articles

An evaluation strategy called ‘Call by Value’

To understand, call by value, we must first understand what is evaluation strategy? All software development companies across the globe use programming languages for custom software development. The programming languages in turn use multiple built-in and user-defined functions ingrained in the source code to get things done. Now, an evaluation strategy governs as to when and in which order parameters/ arguments passed to a function will be called and evaluated, respectively. The evaluation strategy also decides the eventual form that substitution will take.

There are many types of evaluation strategies available, broadly grouped into strict and non-strict evaluation strategies. This grouping is based on the way arguments are handled in a function by a programming language. Call by value belongs to the former grouping of strict evaluation strategies.

Any able software development service company is well-versed with all evaluation strategies in use and understands that some languages combine more than one evaluation strategies (like C++ integrate both call by value and call by reference) and others like Java uses call by reference implicitly, by design.

Now, coming over to ‘Call by value’, it is the most used evaluation strategy across programming languages, as varied as Scheme and C. Under the evaluation strategy, the argument passed to the function is first evaluated and then its determined value is generally copied to a respective variable inside the local scope of the function. As a result, when the function makes any changes to the value of the argument passed inside its local scope and returns the same, the change is not reflected outside the function in the scope of the caller.

To understand by example, say a function Calling_function carrying a variable VAR equal to 10 calls another function within its body, Called_function and passes VAR as an argument. Under call by value evaluation strategy, Called_function will receive the value 10 and bound the same to a local variable say XVAR. The function shall perform necessary action, say add 5 to XVAR and return the value 15 stored in XVAR to the Calling_function. However, the value of VAR shall remain untouched, that is equal to 10 only.


Request a Quote Now



Our Strategic Partners