AC 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?
It is not mentioned in the question that whether we need to answer if all the statements are executed, but I am considering all the statements are executed. If this is not the case please let me know in the comment section.
The value represented by &v is F8D, because & is addressof operator which means the statement is asking the address of v.
pv is a variable which contains the address of v and the value assigned to pv is F8D
* is a dereference operator and the value represented by *pv is B, because at first ‘A’ is present at *pv (please note that pv containt &v and by * operator we are accessing what inside that address i.e. F8D)
but by the statement *pv= v+1;
it is increased by one hence the answer.
The value assigned to u is ‘A’.
The value assigned to &u is F8C.
The value assigned to pu is F8C
The value present at *pu is ‘C’, because first u=*pv+1 (‘B’+1) makes u to ‘C’ then the adress of u is assigned to pu.