Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

1. Step through the following code and answer each question that appears in the

ID: 3891255 • Letter: 1

Question

1. Step through the following code and answer each question that appears in the code comments. Assume that a and b are stored at addresses 20400 and 20408 respectively.

double a = 1000; // 1a: What is contents of a after the instruction executes?
double b = 2000; // 1b: What is contents of b after the instruction executes?
double* p = &a; // 1c: What is contents of p after the instruction executes?
double* q = &b; // 1d: What is contents of q after the instruction executes?
*p = *q; // 1e: What is contents of p after the instruction executes?
p = q; // 1f: What is contents of p after the instruction executes?
*p = 3000; // 1g: What is contents of p after the instruction executes?

Explanation / Answer

As per chegg policy I am solving first 4 parts. Please post rest of them saperatly

1a : 1000

1b : 2000

1c : 20400 (content of p and *p is 1000)

1d : 20408 (content of q and *q is 2000)

1e : *p and *q will become 2000 p will be stored at 20400 and 20408