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

1. A C program contains the following statements: char u, v = ‘A’ ; char *pu, *p

ID: 3666151 • Letter: 1

Question

1. A C program contains the following statements:     

     char u, v = ‘A’ ;

    char *pu, *pv = &v;   

  *pv = v + 1;   

   u = *pv + 1;   

   pu = &u;

Suppose each character occupies 1 byte of memory. If the value assigned to U is stored in (hexadecimal) address F8C and the value assigned to v is stored in address F8D, then a) What value is represented by &v? b) What value is assigned to pv? c) What value is represented by *pv? d) What value is assigned to u? e) What value is represented by &u? f) What value is assigned to pu? g) What value is represented by *pu?

2. A C program contains the following declaration. static char *color[6] = {"red", "green", "blue", "white", "black", "yellow"); a) What is the meaning of color? b) What is the meaning of (color + 2)? c) What is the value of *color? d) What is the value of * (color + 2)? e) How do color [5] and * (color + 5) differ?

Explanation / Answer

1)

(A+1)+1

(a)What value is represented by &v? F8D (b) What value is assigned to pv? F8C (c)What value is represented by *pv? A+1 (d)What value is assigned to u? (A+1)+1 (e) What value is represented by &u? F8C (f)What value is assigned to pu? F8C (g)What value is represented by *pu?

(A+1)+1