- Since C passes arguments to functions by value, there is no direct way for the called function to alter a variable in the calling function
- Because of call-by-value, function below only swaps copies of a and b:
- The way to obtain the desired effect is for calling program to pass pointers to the value to be changed:
- Pointer arguments enable a function to access and change objects in the function that called it
No comments:
Post a Comment