Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Problem #2. C language, Stack Data Placement, Pointers Consider the following C program. Assume that the register SP at the beginning points to Ox0900. Answer
Problem #2. C language, Stack Data Placement, Pointers Consider the following C program. Assume that the register SP at the beginning points to Ox0900. Answer the following questions. Assume all variables are allocated on the stack, and in the order as they appear in the program. ASCII code for character 'O' is 48. 1 2 int main( void) { volatile unsigned long int a = 67; volatile int c = -6, d = 5; volatile char mych = {'0', '2', '4', '8' }; volatile unsigned long int tlpa = ka; volatile int tpi = &d; lpa = Ipa -2; 11 *lpa = *lpa + 513;// pi++; // *pi = pi + c; // } 11 Value/Address Fill in the following table by determining the values/addresses given below. Question? The number of bytes allocated on the stack for the variable declared in line 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 mych[0] after initialization performed in line 4. Address of variable a (&a). Value of Ipa at the moment after the statement in line 7 is executed. 8 Value of *Ipa at the moment after the statement in line 8 is executed. Value of mych[O] at the moment after the statement in line 8 is executed. Value of pi at the moment after the statement in line 9 is executed. Value of *pi at the moment after the statement in line 10 is executed. 10 Ox0900 TOS Comments
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started