Hey guys Im trying to get down some theoretical stuff for Pointers and Arrays. I was hoping someone could reaffirm some suspicions I had with the concept of pointers and arrays.
Suppose I had something like this
int ia[] = {0,1,2,3,4,5};
ia[2]; // =2
int* ip = &ia[0]; // pointer ip gets the address of element 0 in array ia
ip[2]; // ??
ip[2] = 42; //
Most of this code is theoretical obviously but im a bit unsure of the last 2 lines. First off is saying ip[2] the same as saying ip now points to the 2ndth element in the array? Is it equivalent to saying *ip = ia[2] ?
Im also confused with the last line. ip[2] = 42; so the 2ndth element of the object that the ip points to, that address gets the value 42? Or is that an array notation method of dereferencing? Im just a bit confused on whats going on.