# C programming course Question

Before the function f is called, a is assigned the value of 1and b is assigned the value of 2. So at the start of the program a=1 and b=2. When the function f is called, the parameters b+a and b-a are passed into it. the function namesthe first parameter it receives a and the second parameter b, so now a = b+a=2+1=3 and b=b-a=2-1=1 inside the function. These values of a and b are only valid inside the function. Now that we areinside the function, a is set to a+b. since a=3and b=1 inside the function, the new value of a is 3+1=4. bis now set to a*2 +b. remembers a was just set to 4 and bwas set to 1 at the start of the function. this means b now =4*2+1=9. the function then returns the value of b-a, whichhere is 9-4=5. inside the main function b is set to the return value of this function call, so now the variable b in the main funciton is set to 5. the value of a inside the main function isnt changed so it is still = to 1. Hope this is now clear

**2)** a = 4 because you reassign a to be b+a (which is 2+1) when you initially pass it into function f and then reassign it again inside the function to be a +b which now is 3+1 since the value of1 is passed into the function for b. Since a now = 4 b is reassigned to 4*2 +1 inside the function and becomes 9. these values are only true inside the function, which is why they are printed when the print statement inside the function is called.

**3) **a still =1 because it wasn’t reassigned a value outside ofthe function. b however now equals 5 because the function setb to = the value of b-a. remember though that this b-a refersto the values b and a hold inside the function, which in this case is 9 and 4.

**4)** the parameters passed in are the initial value of a and badded and then subtracted. initially a=1 and b=2 so b+a=3 andb-a=1. this is visible in the function call.