Skip to main content
Search type Search syntax
Tags [tag]
Exact "words here"
Author user:1234
user:me (yours)
Score score:3 (3+)
score:0 (none)
Answers answers:3 (3+)
answers:0 (none)
isaccepted:yes
hasaccepted:no
inquestion:1234
Views views:250
Code code:"if (foo != bar)"
Sections title:apples
body:"apples oranges"
URL url:"*.example.com"
Saves in:saves
Status closed:yes
duplicate:no
migrated:no
wiki:no
Types is:question
is:answer
Exclude -[tag]
-apples
For more details on advanced search visit our help page
Results tagged with
Search options not deleted user 7442

Programming questions are off-topic here. Do not ask questions about how to write code in C. However, conceptual questions about computer science are more appropriate. See our help center for the scope of this site.

27 votes
Accepted

Why do negative array indices make sense?

The array indexing operation a[i] gains its meaning from the following features of C The syntax a[i] is equivalent to *(a + i). Thus it is valid to say 5[a] to get at the 5th element of a. … In C, a pointer is abstractly a tuple (start, length, offset) with the condition that 0 <= offset <= length. …
Hari's user avatar
  • 386