Question: Consider the following C code. Assume that variables are stored in memory starting at location 1000, in order and with no gaps between variables.

Consider the following C code. Assume that variables are stored in memory 

Consider the following C code. Assume that variables are stored in memory starting at location 1000, in order and with no gaps between variables. Assume all int's and pointers consume 4 bytes each. a. Show the memory layout and values for the variables at position A. b. Show the memory layout and values for the variables at position B. c. Show the memory layout and values for the variables at position C. d. What is printed by the program? #include int main () { } int x = 2, y = -1; int *p=&x; int *q=&y; int a [3] = (1, 4, 9); // ## A ## *q += 1; 9--; *q += 2; // ## B ## q=&a [1]; *q = 2; p = q++; *p = 0; *q = 3; // ## C ## printf ("%d %d %d ", &p, p, *p); printf ("%d %d %d ", &q, q, *q);

Step by Step Solution

3.38 Rating (145 Votes )

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock

Given the C code provided and the memory layout assumptions a Memory layout and values at position A ... View full answer

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 Programming Questions!