For the following questions assume the variable declarations and initial memory layout shown below: Identifier Address
a 6AFDF4
b 6AFDF0
ptr 6AFDEC
qtr 6AFDE8

int a = 40;
int b = 8;
int *ptr, *qtr;

//Suppose the following statements are executed:
ptr = &a; // statement 1
qtr = &b; // statement 2
*ptr = *qtr; // statement 3
qtr = ptr; // statement 4

Considering these statements answer the following questions

A. Immediately after the execution of statement 1, what is ptr ?

B. Immediately after the execution of statement 2, what is *qtr ?

C. Immediately after the execution of statement 2, what is &qtr ?

D. Immediately after the execution of statement 3, what is ptr ?

E. Immediately after the execution of statement 3, what is *ptr ?

F. Immediately after the execution of statement 4, what is *qtr ?

Solved
Show answers

Ask an AI advisor a question