Consider a two dimensional character array A [1:5,2:7]. Assuming row major order of storage determine the address of element A[2][3] if base address is 500.
एक टू-डायमेंशनल कैरेक्टर ऐरे A [1:5,2:7] पर विचार करें। स्टोरेज के 'रो-मेजर ऑर्डर' (row-major order) को मानते हुए, यदि बेस एड्रेस 500 है, तो एलिमेंट A[2][3] का एड्रेस पता करें।
Key Points
- Row-major order means elements are stored row-wise.
- In row-major order, the address of an element A[i][j] in a 2D array can be calculated using the formula:
- Address(A[i][j]) = Base_Address + [(i - Starting_Row) * Number_of_Columns + (j - Starting_Column)]
मुख्य बिंदु
• रो-मेजर ऑर्डर का मतलब है कि एलिमेंट्स को रो (row) के अनुसार स्टोर किया जाता है।
o रो-मेजर ऑर्डर में, 2D ऐरे में किसी एलिमेंट A[i][j] का एड्रेस इस फ़ॉर्मूले का उपयोग करके निकाला जा सकता है:
o Address(A[i][j]) = Base_Address + [(i - Starting_Row) * Number_of_Columns + (j - Starting_Column)]
Exam Preparation Simplified
Trusted by 8.1 Crore+ Students