Answered step by step
Verified Expert Solution
Link Copied!

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

image text in transcribedimage text in transcribed

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

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Put Your Data To Work 52 Tips And Techniques For Effectively Managing Your Database

Authors: Wes Trochlil

1st Edition

0880343079, 978-0880343077

More Books

Students also viewed these Databases questions

Question

Draw a schematic diagram of I.C. engines and name the parts.

Answered: 1 week ago