2
$\begingroup$

Just like my previous question concerning 'hash'; what exactly is an (or the) "offset?"

Is it a value or data type? Or is it an address location? I have heard it used in different contexts within the computing world. Of course, I have come across it while mounting a disk image; but does it have any other usage than that. I ask this because I have come across the word at other places. Does it have to do anything with memory registers?

$\endgroup$
3
$\begingroup$

An offset is a difference between two indices, usually memory locations or array indices.

For example, suppose that you have an array $A$ in which each element occupies $x$ bytes. Suppose also that the address of $A$ is $M$. Then the address of the $i$th element (counting from zero) is $M + i \cdot x$. Here $i \cdot x$ is the offset. It's the difference between the address of the $i$th element and the address of the array (which is the address of the zeroth element).

$\endgroup$
2
  • $\begingroup$ Is it sort of a logical "distance?" $\endgroup$ – gracedlamb May 8 '16 at 19:13
  • 1
    $\begingroup$ @gracedlamb Yes, that's a nice description. $\endgroup$ – Yuval Filmus May 8 '16 at 19:27

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.