Question: show all work please 1 2 3 4 5 6 8 9 9 11 5. (20 points, C Data Placement on Stack, Pointers) Consider the
1 2 3 4 5 6 8 9 9 11 5. (20 points, C Data Placement on Stack, Pointers) Consider the following program. Assume that the register SP at the beginning points to OXOA00. Answer the following questions. Assume all variables are allocated on the flck, and in the ordenas they appear in the program, ASCII code for character 'o' is 48. int main(void) volatile long int a = -67 volatile intem-6, de -5, volatile char aysh/4) - {0, 12, volatile long nt RR - 681 volatile int *pi = ed 2 RAPA - 27 77 PR = PA + 1026777 pi27 7 *pi-'pi + c 77 ) Fill in the following table by determining the values/addresses given below. # Question? Value/Address 1 The number of bytes allocated on the stack for the variable declared in line 2. 2 The number of bytes allocated on the stack for the character array declared in line 4 The number of bytes allocated on the stack for all variables declared in lines 2-6. Value of mysho after initialization performed in line 4 5 Address of variable a (a). Value of leo at the moment after the statement in line 7 is executed. Value of "la at the moment after the statement in line 8 is executed. 8 Value of boysbL) at the moment after the statement in line 8 is executed. 9 Value of pl at the moment after the statement in line 9 is executed. 10 Value of pi at the moment after the statement in line 10 is executed. (Note: The table below is not going to be graded, you can use it to sketch the stack if you want) 00 TOS Comments 3 4 6 7 1 2 3 4 5 6 8 9 9 11 5. (20 points, C Data Placement on Stack, Pointers) Consider the following program. Assume that the register SP at the beginning points to OXOA00. Answer the following questions. Assume all variables are allocated on the flck, and in the ordenas they appear in the program, ASCII code for character 'o' is 48. int main(void) volatile long int a = -67 volatile intem-6, de -5, volatile char aysh/4) - {0, 12, volatile long nt RR - 681 volatile int *pi = ed 2 RAPA - 27 77 PR = PA + 1026777 pi27 7 *pi-'pi + c 77 ) Fill in the following table by determining the values/addresses given below. # Question? Value/Address 1 The number of bytes allocated on the stack for the variable declared in line 2. 2 The number of bytes allocated on the stack for the character array declared in line 4 The number of bytes allocated on the stack for all variables declared in lines 2-6. Value of mysho after initialization performed in line 4 5 Address of variable a (a). Value of leo at the moment after the statement in line 7 is executed. Value of "la at the moment after the statement in line 8 is executed. 8 Value of boysbL) at the moment after the statement in line 8 is executed. 9 Value of pl at the moment after the statement in line 9 is executed. 10 Value of pi at the moment after the statement in line 10 is executed. (Note: The table below is not going to be graded, you can use it to sketch the stack if you want) 00 TOS Comments 3 4 6 7
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
