The scenario we want to look at now is one where the variables passed need to have their values changed. This is the context you are already familiar with. To the program we've added three print statements to help demonstrate precisely what goes on. We print values of a and b before entering the function, print them again inside the function after the exchange is done, and one last time after control returns to the main program. Here's an explanation.
Every variable has a value and an address .
When we make an assignment, we change the contents of the address of a variable. The way our sample program works, values of a and b are assigned with the declaration, then the values of a and b are passed to exchange. The assignments made in the function exchange hold as long as we stay in the function. The function does not have access to the addresses of the original a and b and so cannot modify their contents. In short, the function received the values of a and b and could only work on them.