Want to get first element of array

>want to get first element of array
>array[0]
wtf i hate coding now

Other urls found in this thread:

en.wikipedia.org/wiki/Generic_programming
boards.Cred
twitter.com/NSFWRedditImage

Why don't you learn Fortran then?

if you can't understand why this is the case, coding is probably not for you

This comes from the fact that you are accessing 0 elements past the start of the array. In C for example you can use "array + 12" as a pointer to the 12th element just as with "array[12]".

Hmm... Good bait. Properly rage inducing, however not too obvious. 8/10, would rage again.

Lua is 1 indexed

wtf i love lua now

LUA is retarded.

LUA stands for LUA Is Not an Acronym

How is that not obvious? I think you're just autistic user
It's not even bait, OP is probably just joking.

The acronym maymay was a mistake. One day some madman is actually going to do something like that

Holy crap OP, how did you get a picture of my friend Tom?

Oh shit you know him too? Good old Tom. I wonder what he's doing nowadays.

>0-indexing
>can only have integer indexes
Try Pascal/Ada, our indices are flexible and the quiche is delicious.

en.wikipedia.org/wiki/Generic_programming
/thread

>array[0]
>not *array

When I learnt that I nearly vomited.

came here to post this

Anderson is active on other social media platforms, including Facebook, Reddit, Twitter (with 238,000 followers as of September 2016), and Google+ (6.50 million followers as of March 2016).

Following an experience with photography at the 2011 Burning Man festival, Anderson's interest in his own photography was piqued. In a September 2014 ABC News interview, Anderson credited friend and photographer Trey Ratcliff for facilitating his skill development, and explained: "I'm not necessarily trying to represent nature exactly. I'm trying to make something beautiful like a painter would." Anderson travels globally with friends to locations such as Thailand and Myanmar, where he primarily focuses upon landscape images.[18]

Anderson also explained in September 2014 that his personal interests have always been diverse:

If you knew me before Myspace, you'd probably thought I'd have been a scholar teaching philosophy in a university my whole life. If you met me before college, you'd probably have thought I'd be a musician for my entire life ... I like change.

Code monkey

Anderson's father was an entrepreneur.[7] As a teenager at San Pasqual High in Escondido, California, Anderson was a computer hacker under the pseudonym "Lord Flathead" (friends with Bill Landreth), and prompted a Federal Bureau of Investigation (FBI) raid after he cracked the security of Chase Manhattan Bank. He was not arrested because of his young age (14).

How dumb are you people
>boards.Cred Forums.org/g
oh

>LINAA
??

VB too

I'm not a coder by any means, why does it work like that? Why is 0 the first item on a list?

already explained

the simplest way of storing an array is a contiguous block of memory, identified by the location of the first element in memory. Therefore, all other elements can be identified by how many elements they are from the first element. Thus, the first element is 0 elements from the first element, the second element is 1 elements away from the first element, etc.

Of course, there's nothing complicated about abstracting this to make arrays 1-indexed or have user-defined indices not limited to just integers, but many languages simply attempt to emulate other languages, like C, which use 0-indexing.

>Not understanding pointers
>pleb
>

*array

Cool. Thanks for the explanation mate

int a[3] = {2, 3, 1};
memory address* 100 101 102
element 2 3 1
^ ^ ^
a = 100 ---------------------------------' ' '
a[0] = a + 0 = 100 + 0 = 100 ------------' ' '
a[1] = a + 1 = 100 + 1 = 101 ----------------' '
a[2] = a + 2 = 100 + 2 = 102 --------------------'


* assumes a single memory unit can store an integer value

What does 100 have to do with it?

its a random address in memory where the array starts

It's more efficient at a low level that way. Not doing this would require an additional temporary variable and a decrementation.