0 0 votes A is a 2D-array with the range [-5....5,3......13] of elements.The starting location is 100. each element accupies 2 memeory cells. Calculate the location of A[0][8] using column major order and row major order.Does indexing matter??Why C follow $0$ indexing?? Programming in C programming-in-c array + – Lakshman Bhaiya 4.4k views answer comment Share Follow Print See all 5 Comments 5 5 Comments reply akshat sharma commented Oct 22, 2018 reply Follow flag from column major 220 Row major 220 0 0 replyShare Lakshman Bhaiya commented Oct 22, 2018 reply Follow flag there is any formula?? Does indexing matter?? Why $C$ follow $0$ indexing?? 0 0 replyShare Magma commented Oct 22, 2018 reply Follow flag The basic concept is range [-5....5,3......13] Now make it normal so that execution is easy -5 to 5 {contains 11 rows } 3 to 13 {contains 11 col} size of an array A 11 x 11 ranges [0 ....10 , 0 ... 10] shift from -5 to 0 we add 5 shift from +3 to 0 subtract 3 therefore A[0+5][8-3] A[5][5] = 100 + (11*5+5)*2 = 100 + 60*2 = 220 similarly we do for col major oder 2 2 replyShare Lakshman Bhaiya commented Oct 23, 2018 reply Follow flag I understand thank you so much 0 0 replyShare Mayankprakash commented Dec 28, 2018 reply Follow flag @Magma @Lakshman Patel RJIT i did not understand your solution from the line shift onwards. Please suggest why did you do like that. thanks 0 0 replyShare Please log in or register to add a comment.
0 0 votes Row major 220 same col major 220 vikashbit055 answered Nov 11, 2018 vikashbit055 comment Share Follow 0 reply Please log in or register to add a comment.