For a 2-D array represented in row-major order, the index formula to access the elementरो-मेजर ऑर्डर में प्रतिनिधित्व किए गए 2-डी सरणी के लिए, रोज़ "I" और कॉलम "J" पर तत्व को
For a 2-D array represented in row-major order, the index formula to access the element
at row "i" and column "j" using the base address "B" is:
रो-मेजर ऑर्डर में प्रतिनिधित्व किए गए 2-डी सरणी के लिए, रोज़ "I" और कॉलम "J" पर तत्व को
एक्सेस करने के लिए इंडेक्स फॉर्मूला "B" का उपयोग करके "B" है:
Show answerHide answer
Correct answer: (A) Index = B + (i * n + j)सूचकांक = b + (i * n + j)
Explanation
In row-major order, rows are stored one after another, so element (i, j) is at B + (i × n + j) × element size, where n is the number of columns. Option D would use m, the row count.Row-major क्रम में पंक्तियाँ एक के बाद एक संग्रहीत होती हैं, इसलिए तत्व (i, j) B + (i × n + j) × तत्व का आकार पर होता है, जहाँ n स्तंभों की संख्या है। विकल्प D में m (पंक्तियों की संख्या) लगता।