What I know?
There is an array, int a[10], and to access first element of it, I can either use a[0] or 0[a];
which leads to
*(a+0) and *(0+a) -> Both results in accessing first element of the array.
What I want to know?
I want to know whether are any cases where it is more practical to use 0[a] instead of a[0]?
No, it’s the other way around.
a + bandb + amean the same thing when one is a pointer and the other is an integer. That leads to*(a + b)and*(b + a)meaning the same thing, and that leads toa[b]andb[a]meaning the same thing.There are some cases that are made more readable by adding a pointer to an integer (
i + p). There are no cases that are more readable by indexing an integer (i[p]). Don’t do it.