Given the following:
int xyz[9] = {88, 99, 22, 15};
int *ptr = xyz;
and assuming that xyz is stored at memory address 2500, what isthe value of each of the following?
- xyz[0]
- xyz[2]
- xyz[4]
- xyz[9]
- &xyz[0]
- ptr
- *ptr
- *ptr+1
- *(ptr+1)
Solution
xyz[0] is 88xyz[2] is 22xyz[4] is not validxyz[9] is not valid&xyz[0] is 2500ptr is 2500*ptr is 88*ptr+1 89*(ptr+1) 99