In a language that uses Call By Value, variables are passed to functions as copies of the variable instead of as references to the variables. For example, if you have a procedure which sets its argument to a new value, the original value that is passed to the argument remains unchanged. In CLanguage:
#include <stdio.h>
int set_to_2 (int x)
{
x = 2;
return x;
}
int main (int argc, char **argv)
{
int foo = 5;
printf ("foo = %d. set_to_2 (foo) = %d. foo = %d.",
foo,
set_to_2 (foo),
foo);
return 0;
}This will display "foo = 5. set_to_2 (foo) = 5. foo = 2." Because the argument of the procedure set_to_2 is passed (or called) by value, it is copied and the copy is modified in the procedure, not the original.
This also means that expressions are evaluated to their value, before they are passed to the function.
