What is offset of array? And how can I define it?

It's very important. Please answer!!!!

Recommended Answers

All 2 Replies

offset is the position relative to the start position.

In the string "ABCDE", the "A" is at offset ZERO (0) while the "D" is at offset THREE (3).

If I start at the "D", the "E" is at offset ONE (1).

Offset means literally "displacement", an offset
is added to an address.

Each item in an array lies then at it's own offset.

'H' 'E' 'L' 'L' 'O', the first 'L' lies at offset 2 into the array,
X0XXX1XXX2X
This is because the offset is added to the beginning of the array's
address, hence an offset of zero references the first data item, here
that is 'H'.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.