Member-only story
Relationship between C Pointers and Arrays
Jun 3, 2022
Relationship between Arrays and Pointers
- &x[0] is the same as x because the variable name ‘x’ points to the first element of the array
- &x[1] is equivalent to x+1 and x[1] is equivalent to *(x+1).
- &x[2] is equivalent to x+2 and x[2] is equivalent to *(x+2).
- Basically, &x[i] is equivalent to x+i and x[i] is equivalent to *(x+i).
- Array names decay to pointers, which means all array names are converted to pointers.