1. A C program contains the following statements: char u, v = ‘A’ ; char *pu, *p
ID: 3784487 • 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?
Explanation / Answer
a) Value represented by &v ---------- F8D
b) Value assigned to pv ---------- F8D
c) Value represented by *pv -------- B (*pv = v + 1; so *pv ='A' + 1 = 'B')
d) Value assigned to u ------- C (u = *pv + 1; so u = 'B' +1 = 'C')
e) Value represented by &u -------- F8C
f) Value assigned to pu ------ F8C
g) Value represented by *pu ---------- C
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.