Question: Problem 1 ( 1 5 pts ) : Nearby is a small C program which makes use of arrays. Pointers, and function calls. Fill in

Problem 1(15 pts): Nearby is a small C program which makes use of arrays. Pointers, and function calls. Fill in the tables associated with the approximate memory layout of the running program at each position indicated. Assume the stack grows to lower memory addresses and that the sizes of C variable types correspond to common 64-bit systems.
# include < stdio.h>
Void and_up(int *xp);
Int main (){
Int arr[5]={19,29,39,49,59};
Int *pos =arr;
Int idx =2;
//position A
Pos =arr +idx;
add_up(pos);
for(idx =0; idx<5; idx++){
printf((%d
, arr[idx]);
}
//POSITION C
Return 0;
}
Void add_up(int *xp){
Int val =*xp;
xp+=2;
Int next =*xp+val;
//POSITION B
*xp = next;
Return;
}
POSITION A
Frame
Symbol
Address
Value
main()
arr[4]
arr[3]
arr[2]
#6072
#6068
#6064
POSITION B
Frame
Symbol
Address
Value
main()
arr[4]
arr[3]
arr[2]
#6072
#6068
#6064
add_up
POSITION C
Frame
Symbol
Address
Value
main()
arr[4]
arr[3]
arr[2]
#6072
#6068
#6064

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!