Question: Problem #2. C language, Stack Data Placement, Pointers Consider the following C program. Assume that the register SP at the beginning points to 0x0800. Answer

 Problem #2. C language, Stack Data Placement, Pointers Consider the followingC program. Assume that the register SP at the beginning points to

Problem #2. C language, Stack Data Placement, Pointers Consider the following C program. Assume that the register SP at the beginning points to 0x0800. 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 '0' is 48 (x30 are allecated on the stacka volatile unsigned long int a 27; volatile volatilechar volatile unsigned lon volatile char *pcmych: 4 6 7 + 513 9 cpc+3 10 Value/Address HQuestion? 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 3 The number of bytes allocated on the stack for all variables declared in lines 2-6. 4Value of mychIO] after initialization performed in line 4. 5 Address of variable a (&a) 6 Address of character array mych 7 Address of variable c 8 Value of lpa at the momentafterthe statement in line 7 is executed. 9 Value of *lpa at the moment after the statement in line 8 is executed. 10 Value of mychlo] at the moment after the statement in line 8 is executed. 11 Value of pi at the moment afterthe statement in line 9 is executed. 12 Value of piat the moment after the statement in line 10 is executed Stack (the table may be used to sketch the stack, but will not be graded) Problem #2. C language, Stack Data Placement, Pointers Consider the following C program. Assume that the register SP at the beginning points to 0x0800. 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 '0' is 48 (x30 are allecated on the stacka volatile unsigned long int a 27; volatile volatilechar volatile unsigned lon volatile char *pcmych: 4 6 7 + 513 9 cpc+3 10 Value/Address HQuestion? 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 3 The number of bytes allocated on the stack for all variables declared in lines 2-6. 4Value of mychIO] after initialization performed in line 4. 5 Address of variable a (&a) 6 Address of character array mych 7 Address of variable c 8 Value of lpa at the momentafterthe statement in line 7 is executed. 9 Value of *lpa at the moment after the statement in line 8 is executed. 10 Value of mychlo] at the moment after the statement in line 8 is executed. 11 Value of pi at the moment afterthe statement in line 9 is executed. 12 Value of piat the moment after the statement in line 10 is executed Stack (the table may be used to sketch the stack, but will not be graded)

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Databases Questions!