I get 6,4,3 for the first 3 questions respectively, but I don't know how to figure out the last one. However, the solution manual indicated 7,5,4,18 as the answers.
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