C a[i] vs i[a]

When following the MIT 6.828 open course, there’s one C source code discussing pointers in Exercise 4 of lab 1.

There’s one line of code in pointers.c:

Looks weird at first sight; but TCPL says in Chapter 5.3:

So: a[i] and i[a] are equvalent (if i is a constant). 🙂

This entry was posted in OS and tagged . Bookmark the permalink.

Leave a Reply

Your email address will not be published.