我得到6,4,3分別爲前3個問題,但我不知道如何找出最後一個。然而,解決方案手冊指出了7,5,4,18作爲答案。激活記錄長度
int sum(int x[], int N) {
int k = 0;
int s = 0;
while (k < N) {
s = s + x[k];
k = k + 1;
}
return s; // the activation record for sum will be ____________ locations
}
int fred(int a, int b) {
return a + b; // (2) the activation record for fred will be ____________ locations
}
void barney(int x) {
x = fred(x, x);//(2) the activation record for barney will be ____________ locations
}
void main(void) {
int a[4];
int x = sum(a, 4);
barney(x);
} // (3) the stack must have at least _____________ locations to run this program
如果這是一個家庭作業問題(考慮到您的其他問題,這是顯而易見的),至少有一個標籤 – 2010-01-11 04:57:16
以及您的答案/猜測是什麼? – 2010-01-11 04:58:11
第一個問題是什麼? – Naveen 2010-01-11 05:01:19