I'm reading a lecture slide in my data structures class for arrays, but there is something that sort of confused me.
The example is in an array called x, defined as follows:
1-dimensional array x = [a, b, c, d] location(x[i]) = start + i
I'm not really understanding this, so could somebody explain this?
start
is a variable, which holds address to the array. Since a pointer in 32-bit system has 4 bytes, it will occupy these four bytes. So if you want 4-byte array, you will actually need 8 bytes of memory: 4 for the array and another 4 for pointer to the first element of this array.
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.