Inside the function the 4is d 2 6 assigned to the

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: t of that function call is 1 , naturally). Inside the function, the 4is d(, 2 6 assigned to the variable name aand the 1 is assigned to b This aand bexist only inside the 2 . function. Consider this example: #nld <otem icue isra> uignmsaesd sn aepc t; itadita itb n d(n , n ) { rtr ab eun +; } itmi( n an) { ita=1; n 5 itb=2; n 0 cu < ada b < ed; ot < d(, ) < nl } Then the aand binside m i ( are different variables than those inside a d ) Even if the code an) d(. inside the function a d )decided to change the values of aand b it would only change the values d( , for the variables known by those names inside the a d )function, not those known by those d( names inside m i ( . The function a d )cannot access the variables declared inside m i ( . an) d( an) Since the variables inside a function are not the same as those inside a different function, they need not have the same names: #nld <otem icue isra> uignmsaesd sn aepc t; itaditsmSlyae,itsmSlyae) n d(n oeilNmX n oeilNmY { rtr (oeilNmX+smSlyae) eun smSlyae oeilNmY; } itmi( n an) { ita=1; n 5 itb=2; n 0...
View Full Document

This note was uploaded on 05/23/2013 for the course CSE 203 taught by Professor Eckroth during the Spring '10 term at Ohio State.

Ask a homework question - tutors are online