Welcome to the Treehouse Community

Want to collaborate on code errors? Have bugs you need feedback on? Looking for an extra set of eyes on your latest project? Get support with fellow developers, designers, and programmers of all backgrounds and skill levels here with the Treehouse Community! While you're at it, check out some resources Treehouse students have shared here.

Looking to learn something new?

Treehouse offers a seven day free trial for new students. Get access to thousands of hours of content and join thousands of Treehouse students and alumni in the community today.

Start your free trial

iOS

Please Help: What is "OFFSET"?

I am currently learning IOS development. I heard the word offset many times I still do not know the meaning of it because English is my second language. I looked dictionary but it not really help in programming. Please help me on this. Thank you!

4 Answers

well as far as arrays go, offset is the distance from the start of the array, or the distance from the memory address of the first member of the array.

so if you had an array of characters "friend", r would have an offset of 1, i would have an offset 2 etc.

WAY more succinct, nice!

Hey Peter,

Here is an example of an offset (written in javascript)

var sampleArray = ['a', 'b', 'c']; sampleArray[2]; //this is the offset

An offset means the distance an index of an array has from the start of an array. So in the above example. sampleArray[2] would be 'c'. 'c' is 2 steps away from the start of the array, with 'a' being step 0, and 'b' being step 1.

I hope this helps.

Now I am understand it I really appreciate you help. Your explanation was really simple and clear it really helped me. Thank you guys so much.

You are very welcome.