Unless otherwise specified, all function parameters in C are passed by value, not reference - which means that a copy of objects is passed to the function, and changes to that copy will not affect the outside world.
If you think about it, that makes a lot of sense.
What if it was passed by reference?
void foo(int bar)
{
bar = bar * 2;
}
...
int x = 666;
foo(x);
would not cause any problems, and x would contain the new value.
But what happens if we do this?
void foo(int bar)
{
bar = bar * 2;
}
...
foo(666);
Should the value of a constant be changed? That's not a good idea, not at all!
To tell C to pass by reference, you pass a pointer to the value:
void foo(int* bar)
{
*bar = *bar * 2;
}
...
int x = 666;
foo(&x);
And the system will now not allow you to pass a constant, only a variable!
See here:
Function call by reference in C - Tutorialspoint[
^]