6 ms·
I didn't understand why a[3] == 3[a], but i found this stackoverflow that explains it. https://stackoverflow.com/a/16163840 https://stackoverflow.com/a/1616384
by parlortricks 4mo ago
I didn't understand why a[3] == 3[a], but i found this stackoverflow that explains it.
https://stackoverflow.com/a/16163840 https://stackoverflow.com/a/16163840
In C a[i] is converted to *(a+i) internally. i[a] is converted to *(i+a). Array names also act as pointers in c. so (a+i) or (i+a) give an address (using pointer arithmetic) that is dereferenced using
- parlortricks 4mo agoIn C a[i] is converted to *(a+i) internally. i[a] is converted to *(i+a). Array names also act as pointers in c. so (a+i) or (i+a) give an address (using pointer arithmetic) that is dereferenced using *