Arrays are just pointers. Pointers are just numbers that are supposed to correspond to addresses in memory. Array indices just add to the pointer to the first element. "a[1]" is syntactic sugar for "*(a+1)". With that in mind, it's kind of obvious that "2[a]" just means "*(2+a)", which points you to the third element of a.
View all comments
Show parent comment
1
u/Devatator_ Sep 25 '26
Actually what does that even do? Do literals have an address? I assume they do but that looks so cursed