Comment

Comment by smcameron

> (In fact, that's what array[i] means – the language defines it to be a synonym for *(array+i).)

To really drive home the primitiveness of C arrays, should probably also mention that, because addition is commutative, you could also write

     i[array]
and somewhat surprisingly, it will compile, and work, and it means "*(i + array)" which is equivalent to "*(array + i)"

But nobody really does that, because that would be kind of insane.

parent smcameron 5 years ago

Discussion

Live from the official Hacker News API

A modern reader for Hacker News · SvelteKit + Skeleton