Question: Description Trace the following program by hand. Both files contain the same program. You can print either file and write your answers next to each

Description

Trace the following program by hand. Both files contain the same program. You can print either file and write your answers next to each line of code. When done, take a picture and upload it here. Trace it by hand so you understand how the code works. It is not about right or wrong answers. It is about being able to trace, learning to read code written by someone else, and understanding pointers. Show all work. Full credit for any reasonable attempt.

S23 Pointer Arithmetic.docx

Tips/Examples Unary operators *, ++, -- have the same order of precedence. When the precedence of operators is the same, use the associativity rule. for *, +, -- associativity is right to left. For example, *++p is the same as *(++p), pre-increment pointer first then go through the pointer you can use pointer notation with array names *(myArr+3) is the same as myArr[3] you can use array notation with pointers p[3]- you are in front of one of the doors in a corridor with a bunch of doors and you have a magic vision to see what's in the room three doors down from the door you are looking at now. #define p(x) cout

p(a) // prints a=20; note ";" is not needed

p(a+z) // prints a+z= 85 Answers Example: Description Trace the following program by hand. Both files contain the same

Code: program. You can print either file and write your answers next to

- Answers Example #18+(p1+7)=16132104+74+[13+[7]+[8]19+p1=0 n the image above, #19 should be p1=2. After line 18p1 points to the same location as before line \#18

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!