Functions (cont)
When a function is called:
- memory is allocated for its parameters and local variables
- the arguments in the calling function are evaluated
- C uses "call-by-value" parameter passing …
- the function works only on its own local copies of the parameters, not the ones in the calling function
- local variables need to be assigned before they are used (otherwise they will have "garbage" values)
- function code is executed, until the first
return statement is reached
|