Discussion
What will be the address of the arr[2][3] if arr is a 2-D long array of 4 rows and 5 columns and starting address of the array is 2000?
Answer: C
Correct answer: 2052
With 5 columns and 4 bytes per element, row-major gives
\[ 2000 + 4\,(2 \times 5 + 3) = 2000 + 4 \times 13 = 2052 \]The row count, 4, does not enter the calculation - only the number of columns matters, because that is how far one row-step moves you.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development