(in c++) Consider the following definitions: int xyz[5][4] = { {10,20,30,40}, {3
ID: 3676011 • Letter: #
Question
(in c++)
Consider the following definitions:
int xyz[5][4] = { {10,20,30,40}, {31,41,51,61}, {52,62,72,82}, {73,93,103,113}, {94,114,134,154} } ;
int *p ;
int *q ;
int *r ;
p = xyz[0] ;
q = xyz[1] ;
r = &xyz[2][2] ;
(a) What is the value of *p ?
(b) What is the value of *(p+2) ?
(c) What is the value of *p+2 ?
(d) What is the value of *q ?
(e) What is the value of *(q+2) ?
(f) What is the value of *q+2 ?
(g) What is the value of *r ?
(h) What is the value of *(r-1) ?
(i) What is the value of *r-1 ?
(j) What is the value of *(r+3) ?
(k) What is the value of *r+3 ?
Explanation / Answer
(a) What is the value of *p ?
= xyz[0][0] = 10
(b) What is the value of *(p+2) ?
= xyz[0][2] = 30
(c) What is the value of *p+2 ?
= xyz[0][0] + 2 = 12
(d) What is the value of *q ?
= xyz[1][0] = 31
(e) What is the value of *(q+2) ?
= xyz[1][2] = 51
(f) What is the value of *q+2 ?
= xyz[1][0] + 2 = 33
(g) What is the value of *r ?
= xyz[2][2] = 72
(h) What is the value of *(r-1) ?
= xyz[2][1] = 62
(i) What is the value of *r-1 ?
= xyz[2][2] - 1 = 71
(j) What is the value of *(r+3) ?
= xyz[3][1] = 93
(k) What is the value of *r+3 ?
= xyz[2][2] + 3 = 75
Related Questions
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.