Answers

2014-11-16T04:15:15+05:30

This Is a Certified Answer

×
Certified answers contain reliable, trustworthy information vouched for by a hand-picked team of experts. Brainly has millions of high quality answers, all of them carefully moderated by our most trusted community members, but certified answers are the finest of the finest.
call by value mechanism is same in any programming language.

The apply the call by value in a function,  you have to use the formal parameter specification as per call by value.   The language tells you how to specify for call by value or call by reference mechanisms.  You have to follow that way as told by the rule of the language.

It is the default mechanism in a programming language, in general.  You just have to write the variable name (identifier) or expression as the parameter of the function, when calling the function.

=======================================
Suppose you have a function defined as follows.
 
   integer  My_add( integer A,  integer B) 
   begin 
           integer  C =  A + B ;
            //  A = 10;   B = 7;
   end
============
In the main program you call the function by the following procedural (sequential control) statement.

   integer X, Y, Z ;
   X = 5;
   Y = 4 ;
   Z =  My_add ( X, Y) ;
====================
you can also write  :    Z = My_add (5, 4);

Here the formal parameters A and B in the function My_add are call by value parameters.  The parameters X and Y in the main program will not be changed after the addition function is executed.

Thus even the commented statements in the function are executed, the values of X and Y in the main program do not change.

0