Answered step by step
Verified Expert Solution
Link Copied!
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)

image text in transcribed

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

blur-text-image
Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image_2

Step: 3

blur-text-image_3

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Spatio Temporal Database Management International Workshop Stdbm 99 Edinburgh Scotland September 10 11 1999 Proceedings Lncs 1678

Authors: Michael H. Bohlen ,Christian S. Jensen ,Michel O. Scholl

1999th Edition

3540664017, 978-3540664017

More Books

Students explore these related Databases questions