C Lang - Pointer - TechRepublic
General discussion
October 7, 2001 at 05:16 AM
nt259

C Lang – Pointer

by nt259 . Updated 24 years, 8 months ago

Pls help me to see if I have answer correctly.
If my answer is wrong, pls help to explain
– James

char first=?w?, second; /* ASCII value of ?w? is 119 */
char *pfirst, *psecond = &second; /* question (b) */

*psecond = first + 10;
first = second + 1; /* question (c) */
pfirst = &first; /* question (d) */

Suppose each character occupies 1 byte of memory. If the value assigned to first is stored in address 1200 and the value assigned to second is stored in address 1201, then

a)What value is represented by &second ?
ANSWER : 1201

b)What value is assigned to psecond ?
ANSWER : 120

c)What value is assigned to first ?
ANSWER : 129

d)What value is assigned to pfirst ?
ANSWER : 130

e)What value is represented by (100 + *pfirst)?
ANSWER : 1300

This discussion is locked

All Comments