The following C program is compiled and executed on the LC-3. When
the program is executed, the run-time stack starts at memory location
xFEFF and grows toward xC000 (the stack can occupy up to 16 KB of
memory).
int SevenUp(int x)
{
if (x == 1)
return 7;
else
return (7 + sevenUp(x - 1));
}
int main(void)
int a;
printf("Input a number \n");
scanf("%d", &a);
a = SevenUp(a);
printf("%d is 7 times the number\n", a);
a. What is the largest input value for which this program will run
correctly? Explain your answer.
b. If the run-time stack can occupy only 4 KB of memory, what is the
largest input value for which this program will run correctly?
Already registered? Login
Not Account? Sign up
Enter your email address to reset your password
Back to Login? Click here