Question 8476 – Arrays
April 19, 2024Computer-Networks
April 19, 2024Arrays
Question 13
|
P[2][5]
|
|
*(*(P+2)+5)
|
|
*(P[2]+5)
|
|
*(P+2+5)
|
P[2][5] represents the element present in column five of row two. So it can be used to access the required given element in question.
Option (B):
*(*(P+2)+5)
*(P+2) → will lead to enter row two.
(*(P+2)+5) will give address of element present at fifth column of row 2.
→ *(*(P+2)+5) will return element present at fifth column of row 2.
Hence option (B) is Correct.
Option (C): *(P[2]+5)
P[2] → will give starting address of row 2
P[2]+5 → will give address of element present at 5th column of row 2.
*(P[2]+5) → will return the element present at 5th column of row 2.
Hence it is correct option.
Option (D): *(P+2+7)
= (P+7)
*(P+7) will return starting address of 7th row.
→ Hence it is not the correct answer.
P[2][5] represents the element present in column five of row two. So it can be used to access the required given element in question.
Option (B):
*(*(P+2)+5)
*(P+2) → will lead to enter row two.
(*(P+2)+5) will give address of element present at fifth column of row 2.
→ *(*(P+2)+5) will return element present at fifth column of row 2.
Hence option (B) is Correct.
Option (C): *(P[2]+5)
P[2] → will give starting address of row 2
P[2]+5 → will give address of element present at 5th column of row 2.
*(P[2]+5) → will return the element present at 5th column of row 2.
Hence it is correct option.
Option (D): *(P+2+7)
= (P+7)
*(P+7) will return starting address of 7th row.
→ Hence it is not the correct answer.