Assuming that length, nSlices and nBinsE ar global variables, their values are set by the arguments of their specific functions. What this means is that when you call SetTargetLength, the global variable length will be set to the argument you called SetTargetLength with. For example, if you call SetTargetLength(5.1), length will be set to 5.1. However, nSlices and nBinsE will not be set to 5.1, because they weren't called with that value.
The arguments of a function are local to that function.
In other words, what toexii is saying is the variable "val" is not essentially the same, each has a life time that ends when "}" of the function is encountered, meaning when the function call ends it ceases to exist.
length and nSlices and nBinsE would take the same value if "val" was not provided as an argument, but rather declared outside the function