The most important thing is to know what happens when a return type function is used . let us taken a simple example
of it .
function with return type :
sum()- this is a function call.when the program encounters this statement it automatically goes to the definition part of the function from the main function.the point to be noted in here is before going to the defintion part of a function it stores the function call line address of the main function to the stack. now after executing that function when it encounters the closing "return" statement of the function. the stored address in the stack helps it to come back to the line where it is called from the main function program.
look down the fig below and follow the steps :
of it .
function with return type :
sum()- this is a function call.when the program encounters this statement it automatically goes to the definition part of the function from the main function.the point to be noted in here is before going to the defintion part of a function it stores the function call line address of the main function to the stack. now after executing that function when it encounters the closing "return" statement of the function. the stored address in the stack helps it to come back to the line where it is called from the main function program.
look down the fig below and follow the steps :
No comments:
Post a Comment