Basically, when calling a function that requires (a) parameter(s) in C, you have two options; you can pass by value, or by reference.
When passing by value, the value of the parameter you are caling the function with, will be copied, and will NOT be the same reference.
Here's code for a small illustration:
Code:
void add(int);
int main(int argc, char **argv)
{
int i = 2;
add(i);
return 0;
}
void add(int a)
{
a += 5;
}
In main, after calling the function add(int), passing the local variable 'i' as parameter, 'i's value will not be modified whatsoever, because we are passing 'i' by value, and not by reference; so, therefore, the value of 'i' is copied into the function.
When passing by reference, the variable passed as a parameter will be modified according to the function.
Example:
Code:
void add(int *);
int main(int argc, char **argv)
{
int i = 2;
add(&i);
return 0;
}
void add(int *a)
{
(*a) += 5;
}
In this application, after calling the add(int*) function, passing 'i' as parameter, the value of 'i' will be changed. '5' will be added to the variable passed in the function (i) and since we are using pass by reference, it will modify the passed argument directly; in this case '1'.