|
I can tell you that:
|
Here a summary of what you have learned about subroutine call/return:
|
I will illustrate them with a commonly used method definition:
/* ---------------------------------------------------------- sumRange(A,a,b): returns (A[a] + A[a+1] + ... + A[b-1]) ---------------------------------------------------------- */ int sumRange(int[] A, int a, int b ) { int i, s; s = 0; for (i = a, i < b; i++) s = s + A[i]; return(s); } |
You can see that besides the function/method name (which translates to a label) and the statements inside the method (which will translate into assembler instructions - just like in the main program that we have seen in so many prior examples), you find these new features:
|
|
In the next discussions, we will organize the memory cells in the CPU and in the computer memory to store parameters, return values and local variables
So pay attention to how we organize !!!
|
|
|
|
|
|
|
|
|
|
I will discuss method 1 next
Method 2 will be discussed later.
|
Therefore:
|
|
I will discuss method 1 next
Method 2 will be discussed after later.