Question: 7. Examine the C program that follows: (a) Draw the run-time stack just after the procedure is called for the last time, including the stack
7. Examine the C program that follows:
(a) Draw the run-time stack just after the procedure is called for the last time, including the stack frame for main().
(b) What is the output of the program?
#include
void what(char *word, int j) {
if (j > 1) {
word[j] = word[3 - j];
what(word, j - 1);
} // ra2
} int main() {
char str[5] = "abcd";
what(str, 3);
printf("%s", str); // ra1 return 0;
}
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
