For this question, I needed to determine the final values of all p, q, w, and x after the following program runs. I have

Business, Finance, Economics, Accounting, Operations Management, Computer Science, Electrical Engineering, Mechanical Engineering, Civil Engineering, Chemical Engineering, Algebra, Precalculus, Statistics and Probabilty, Advanced Math, Physics, Chemistry, Biology, Nursing, Psychology, Certifications, Tests, Prep, and more.
Post Reply
answerhappygod
Site Admin
Posts: 899604
Joined: Mon Aug 02, 2021 8:13 am

For this question, I needed to determine the final values of all p, q, w, and x after the following program runs. I have

Post by answerhappygod »

For this question, I needed to determine the final values of all
p, q, w, and x after the following program runs. I have already
figured out the answers by using a cout statement but I need
help understanding how to actually get the numbers that are output.
Please explain how to trace what is going on so I know how to
determine the answer without using a cout statement.
void main()
{
int p, q, *r, *s;
float w, x, *y, *z;

r = &q;
*r = 13;
p = q;
s = r;
r = &p;
y = &w;
z = &x;
*s += 1;
*y = *s;
*z = *y;
}
Join a community of subject matter experts. Register for FREE to view solutions, replies, and use search function. Request answer by replying!
Post Reply