Question: Consider the following program. Assume that the register SP at the beginning points to OXOE00. Answer the following questions. Assume all variables are allocated on



Consider the following program. Assume that the register SP at the beginning points to OXOE00. Answer the following questions. Assume all variables are allocated on the stack, and in the order as they appear in the program. A. (10 points) illustrate the content of the stack at the moment before the statement at line 7 is executed. B. (10 points) Comment the code (lines 7-11) indicating the result of each statement. illustrate the content of the stack at the end of execution of the statement in line 11. What are the contents of arrays x and carr? volatile unsigned int x[4]={1, -32768, 0, -3); volatile char carr[4]={ 'A', '1', '2', 'a'}; volatile long int z = 65536; volatile char *p_c = carr; volatile int *p_i = x; *(_C + 2) += 'b'; p_i = p i + 3; *p_i += *(p i-6); P_C = D.C + 3; *P_C = 'A'; 11 Address M[15..0) Comment 1 2 volatile unsigned int x[4]={1, -32768, 0, -3); volatile char carr[4]={'A', '1', '2', 'a'); volatile long int z = 65536; volatile char *pc = carr; // volatile int *p_i = x; // | 3 4 5 6 | 7 | 8 | 9 10 11 p *(P_C + 2) += 'b'; i = p_i + 3; *p_i += *(p_i -6); P_C = P_C + 3; *pc = 'A'; // // // // // Address M[15..] Comment Consider the following program. Assume that the register SP at the beginning points to OXOE00. Answer the following questions. Assume all variables are allocated on the stack, and in the order as they appear in the program. A. (10 points) illustrate the content of the stack at the moment before the statement at line 7 is executed. B. (10 points) Comment the code (lines 7-11) indicating the result of each statement. illustrate the content of the stack at the end of execution of the statement in line 11. What are the contents of arrays x and carr? volatile unsigned int x[4]={1, -32768, 0, -3); volatile char carr[4]={ 'A', '1', '2', 'a'}; volatile long int z = 65536; volatile char *p_c = carr; volatile int *p_i = x; *(_C + 2) += 'b'; p_i = p i + 3; *p_i += *(p i-6); P_C = D.C + 3; *P_C = 'A'; 11 Address M[15..0) Comment 1 2 volatile unsigned int x[4]={1, -32768, 0, -3); volatile char carr[4]={'A', '1', '2', 'a'); volatile long int z = 65536; volatile char *pc = carr; // volatile int *p_i = x; // | 3 4 5 6 | 7 | 8 | 9 10 11 p *(P_C + 2) += 'b'; i = p_i + 3; *p_i += *(p_i -6); P_C = P_C + 3; *pc = 'A'; // // // // // Address M[15..] Comment
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
