this post was submitted on 08 Mar 2024
336 points (100.0% liked)

196

16449 readers
1937 users here now

Be sure to follow the rule before you head out.

Rule: You must post before you leave.

^other^ ^rules^

founded 1 year ago
MODERATORS
 

A ruler with the logo for the Lua Programming language

you are viewing a single comment's thread
view the rest of the comments
[–] [email protected] 4 points 8 months ago* (last edited 8 months ago) (5 children)

There's a syntax for indexing starting from 0, it's

*(&arr+0) to *(&arr+(n-1))

For the rest of us who are manipulating sets of values and not offsets on pointers and aren't delusionally attached to conventions, there's arr[1] to arr[n]

[–] [email protected] 2 points 8 months ago

But then arr.length == the last index, and that’s just too convenient :(

load more comments (4 replies)