#Day21 #100DaysOfCode
multidimensional array is a very cool indeed important concept I always wanted to pick up but never had a chance to. I was told by my teacher a long ago but never realized it in practice. now it's the time.
multidimensional array is array of arrays. it is often referred to as matrix. but it's more than just matrix. it's matrix of matrix. but the core concept just gets down to array of arrays.
a 3d array is an array of 2d arrays. a 2d array is a series of 1d array. because multidimensional arrays cannot be represented in a computer memory, instead they are built up from 1d array.
there are two different kinds of pointers. a pointer that points to the first element of the array. and the pointer that points to the whole array. An array itself is a pointer that stores the computer memory address so that the next elements can be accessed sequentially.
The base address of an array is the address of the first element of the array. A pointer points to an array will return this value. when it increments by some index value, it moves up by the data type. i.e: base address + i * sizeof(data_type)
sizeof(data_type) is measured in bytes, whereas the address is measured in hexadecimals. therefore, when calculating addresses, they need to be converted to hexadecimals. i.e: A pointer points to the whole array when increments will shift a total number of bytes equal to the array bytes. i.e: pointer to an array of 5 integer elements will move 20 bytes forward, which is 14 in hexa.
its a very important concept, thus need to be studied carefully.
multidimensional array is a very cool indeed important concept I always wanted to pick up but never had a chance to. I was told by my teacher a long ago but never realized it in practice. now it's the time.
multidimensional array is array of arrays. it is often referred to as matrix. but it's more than just matrix. it's matrix of matrix. but the core concept just gets down to array of arrays.
a 3d array is an array of 2d arrays. a 2d array is a series of 1d array. because multidimensional arrays cannot be represented in a computer memory, instead they are built up from 1d array.
there are two different kinds of pointers. a pointer that points to the first element of the array. and the pointer that points to the whole array. An array itself is a pointer that stores the computer memory address so that the next elements can be accessed sequentially.
The base address of an array is the address of the first element of the array. A pointer points to an array will return this value. when it increments by some index value, it moves up by the data type. i.e: base address + i * sizeof(data_type)
sizeof(data_type) is measured in bytes, whereas the address is measured in hexadecimals. therefore, when calculating addresses, they need to be converted to hexadecimals. i.e: A pointer points to the whole array when increments will shift a total number of bytes equal to the array bytes. i.e: pointer to an array of 5 integer elements will move 20 bytes forward, which is 14 in hexa.
its a very important concept, thus need to be studied carefully.