Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

this is what i have assume that m,p, and q are in consecutive increasing memoryl

ID: 3611083 • Letter: T

Question

this is what i have assume that m,p, and q are in consecutive increasing memorylocations( m first, p next, then q last) &m == 100; int m = 108 int* p = &m int** q = &p what is the value of each expression a) *p = 108 (since it points to what is at&m) b) &q = 108 (since the adress is 108 because theyare stored consecutivly and int are (4 bytes) c) *(p+1) +8 = ? d) **q = ? e)q[-1] = ? f)q[-1][-2] = ? i dont understand what the last few are even asking. i knowthat the aswer to all of them is 108 but i dont know what theexpressions are asking could someone explain please. i appreciateit thank you this is what i have assume that m,p, and q are in consecutive increasing memorylocations( m first, p next, then q last) &m == 100; int m = 108 int* p = &m int** q = &p what is the value of each expression a) *p = 108 (since it points to what is at&m) b) &q = 108 (since the adress is 108 because theyare stored consecutivly and int are (4 bytes) c) *(p+1) +8 = ? d) **q = ? e)q[-1] = ? f)q[-1][-2] = ? i dont understand what the last few are even asking. i knowthat the aswer to all of them is 108 but i dont know what theexpressions are asking could someone explain please. i appreciateit thank you

Explanation / Answer

c) *(p+1) +8 = ? p is pointing to address of m so p+1 is the address of p. reason: pis next to m so *(p+1) = 100 , value at address of p =100 so 100 + 8 = 108 d) **q = 108 , double pointer point to m. e)q[-1] = ? = *(q-1)       q have address of p, now *p = value at m = 108 c) *(p+1) +8 = ? p is pointing to address of m so p+1 is the address of p. reason: pis next to m so *(p+1) = 100 , value at address of p =100 so 100 + 8 = 108 d) **q = 108 , double pointer point to m. e)q[-1] = ? = *(q-1)       q have address of p, now *p = value at m = 108