Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

This is still true, and it's mandated by the ISO C standard that a[i] is equivalent to (*((a)+(i))) (yes, they specify it with that many parentheses). You're still able to compile code that treats a[i] and i[a] interchangeably.

https://godbolt.org/z/37Kv44o1b

> I had read this in some C book, maybe K&R or the Waite Group C Microsoft Bible.

I haven't read the Microsoft C Bible, but it does say this in K&R while explaining pointers.



>This is still true, and it's mandated by the ISO C standard ...

Wow, good to know.

>but it does say this in K&R

Then that must be where I had read it.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: