UMBC CMSC 201
CSEE | 201 | 201 F'06 | lectures | news | help
Recall that C uses call by value for scalars, which means that (a copy of) the address of i is passed to scanf. The scanf routine reads in the data, and places it in the indicated address.
In general, if a subroutine needs to modify a scalar variable, it needs to receive the address of that variable as a parameter. For example,