Oh, so A[i] will automatically follow the pointer to the specific person and A[i]->random_int will automatically access the int in the person?

Well, A[i] is just an array element. It will be whatever type you've defined your array as. If it's an array of ints, then it's an int. If it's an array of pointers to Person, then it's a Person*. The symbol A[i] will behave as a variable of that type, whatever the type is.

Did you define it that way the second time to show me that it works the same way, or did you not see that I defined it person ** A = new person * [arraysize]. Not being arrogant, just asking.

Um, I was showing you how to logically break down the process of accessing members of your structs. If you want me to make it more complete (and correct your typo):

1234567

Person ** A = new Person* [arraysize]; // Declare an array of Person*// Presumably, some code to populate the array with pointers to actual Person objects
Person* aPerson = A[i]; // Store the array element in its own variable
something_else = aPerson->random_int; // Get the value of a member of the Person object

What helped me was to think of pointers as any other variable, but instead of numbers or text they contain addresses of memory. You could print a pointer like this:

1234

int a;
int* p = &a;
std::cout << p;

It will print out the current address of the first byte of 'a'. In other words, the pointer refers to the space in memory where 'a' is. Now, that's not usually what we need, we usually want to access the value in that memoryspace. Accessing that value means we have to dereference that address.

When you have an array, the brackets actually serve as a dereferencing operator:

123

int arr[10];
//arr[5] == arr + 5

The name of the array is actually a pointer to the start of the array, the brackets count 5 spaces further and dereference it for you. This happens under the hood, so you don't really realize it happens.

Now to your example, you said you wanted an array of pointers to objects:

1234567

//remember, arr is a pointer in its own way
Person** arr = new person* [size];
Person* p = new Person();
arr[0] = p;
std::cout << arr[0]; //prints address of first person
std::cout << arr[0]->name; //prints the name member of the first person

The []-operator has precedence over the -> operator (because it is to the left of it), so what happens is this: