C++ Pointer Pointing to index of an Array of Objects -


quick questions pointers. in example:

  object *o;    object** array = new object*[3];    o = array[0]; 

in example, o point spot array[0] or object located in position? example, if object in index 0 gets swapped object in spot 2, understand o should still have access object not new 1 in array[0], right?

sorry want double check. been working on day w/o sleep & starting question what's @ point.

your assumptions correct.

when doing o = array[0]; assignment (which equivalent writing o = (*array);) copy pointer stored in array pointer variable o. change array afterwards won't change contents of o, since copy.


Comments

Popular posts from this blog

Java sticky instances of class com.mysql.jdbc.Field aggregating -