You are not logged in. Your edit will be placed in a queue until it is peer reviewed.
We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.
Required fields*
-
7Unless someone can dig up sources from interviews etc., the answer will probably remain opinion-based and speculation, but data structures were a hot topic in other languages at that time (Algol), and those languages did distinguish between pointers and arrays. IIRC it also makes a difference for lvalues vs. rvalues (but I would have to look this up).dirkt– dirkt2026-03-04 05:01:24 +00:00Commented yesterday
-
2" 0[ptr] == ptr[0] == *ptr " -- this part is actually pretty true (the same or equivalent) in C. Because a[b] is effectively *(a+b), thus no difference between a[b] and b[a].lvd– lvd2026-03-04 10:06:02 +00:00Commented 20 hours ago
-
It depends on the types of a and b, but as long as one is an integer and the other a pointer, you're fine. a[b] is equivalent to the expression *((a) + (b)). Adding an integer to a pointer gives an address depending on the pointer type, regardless of whether the integer or the pointer comes first. Adding two pointers isn't allowed.Stuart F– Stuart F2026-03-04 12:55:17 +00:00Commented 17 hours ago
-
Before addition, integer is multipied by the size of object which the pointer is typed with. Therefore, *(ptr+index) is always fine, the same as ptr[index] or index[ptr].lvd– lvd2026-03-04 13:53:28 +00:00Commented 16 hours ago
-
Note that BCPL had neither have data-structures nor pointers as in C , instead it had word-pointers (to the pain of Amiga users) so for 32-bit words and 8-bit bytes it means that all pointers were divided by 4. Since C improved that part could that be linked with the syntax change (either because some version had both and needed different syntax, or just to avoid confusion)?Hans Olsson– Hans Olsson2026-03-04 14:24:16 +00:00Commented 16 hours ago
|
Show 1 more comment
How to Edit
- Correct minor typos or mistakes
- Clarify meaning without changing it
- Add related resources or links
- Always respect the author’s intent
- Don’t use edits to reply to the author
How to Format
-
create code fences with backticks ` or tildes ~
```
like so
``` -
add language identifier to highlight code
```python
def function(foo):
print(foo)
``` - put returns between paragraphs
- for linebreak add 2 spaces at end
- _italic_ or **bold**
- quote by placing > at start of line
- to make links (use https whenever possible)
<https://example.com>[example](https://example.com)<a href="https://example.com">example</a>
How to Tag
A tag is a keyword or label that categorizes your question with other, similar questions. Choose one or more (up to 5) tags that will help answerers to find and interpret your question.
- complete the sentence: my question is about...
- use tags that describe things or concepts that are essential, not incidental to your question
- favor using existing popular tags
- read the descriptions that appear below the tag
If your question is primarily about a topic for which you can't find a tag:
- combine multiple words into single-words with hyphens (e.g. ms-dos), up to a maximum of 35 characters
- creating new tags is a privilege; if you can't yet create a tag you need, then post this question without it, then ask the community to create it for you