Arrays

What does the statement below do?

 
    arr[arr[a]] = arr[2] + 5;
Assigns the value stored in arr[2] to the element of array arr with index equal to arr[a].
remember that when vlad says "arr with index equal to arr[a]" you have to apply the pointer arithmetic to that arr[a], basically you obtain the right value by adding a to the memory address where arr starts/it's stored. You can read that as arr + a if you know what they mean.
@seven50
You can read that as arr + a if you know what they mean.


arr[a] is equivalent to *(arr + a)
yes, I was focusing on the arithmetic and I forgot the *, my bad.
Topic archived. No new replies allowed.