Answered step by step
Verified Expert Solution
Question
1 Approved Answer
1. (0.5 pts each) Given the variable declarations below, write V in the blank provided if the statement in each item is (semantically and syntactically)
1. (0.5 pts each) Given the variable declarations below, write V in the blank provided if the statement in each item is (semantically and syntactically) valid. Write I, otherwise. char **cptr, c, x = 'A', y = 'B', z = '2'; int v, w - 7, *p1, *p2, **pptr; 1. cptr - &c; 6. pptr - p2; 2. p1 = &v: 7. cptr = kp2; 3. pptr -&p1; 8. P2 = *pptr; 4.0 -ky: 9. *p1 = 21; 5. pptr - kv; 10. *C = z; II. (0.5 pts each) Executing all valid statements in Test I, write in the blank the output of the following state- ments or the value of the variables. 1. y -6. (*p2) + (**pptr) -2. v 7. printf("%c %c", c, z); _8. V + v + (*p2 - w) 4. **ptr -9. **pptr + w _5. *cptr _10. *p2 + *p1 + **pptr III. (5 pts) Draw on the right column the resulting box-and-arrow diagram of the code snippet from the left. Assume that everything is in the main() function. Draw a diagram for each assignment statement to show how the pointers and values change for each assignment statement. 1 int x=2, y=3, z=4, *a; 2 int **P, *, **d; 3 4 =&c; 5 C = &x: 6 d =P 7a -ky: 8 **p = 7; 9*P = a; 10 **d = .C + **P: 11 * dz: 12 sa = X
Step by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started