Puzzles P11 ... P20

Pointers and Parameters

Parameter passing in C is always done by call by value. This means that when a function is called, arguments of the function call are evaluated and the values are copied into the parameters of the function. As the function executes it works with the values in its parameters. Changing these values does not affect any other variable in the program.

However, the value that is copied into a parameter can be a pointer value if the parameter has been declared as such. In that case, the pointer value can be used to access the variable it points at and can change it.

Next Page         Home