Let’s imagine the frame buffer to be a matrix of 100x100, so we define this as 2d array in C(or any language for that matter), note that the size of the array should be actually array[101][101] since we need to store 100, this is from the fact that if you need to store a single element in a array you need to declare it as array[1] and not array[0] which would not make sense, right?
Now we have maximum rows = maximum colums = 101. So we can get the address of element by using row-major order.
Case 1: Row Major Order
Address = Base Adress + Size of Single Element * (Row * Maximum Row Value) + Column
So, we have,
0 + 1 * (6 * 101) + 10 = 616
Case 2: Column Major Order
Address = Base Address + Size of Single Element * (Column * Maximum Column Value) + Row
So, we have,
0 + 1 * (10 * 101) + 6 = 1016
I have no clue what is the answer, some website says it’s 616 and some say it’s 1016. If anyone have any ideas, please comment below. I really would like to know.