Refer to an element in a dynamic array

I've made an array of objects, located in the free store ("number" is a var given by the user):
student *x=new student[number];

"student" is a class. An object of this class has several properties (naam, voornaam...). But how do I refer to one of this objects' properties?

I tried this:
x[1]->naam;

But it doesn't work. Compile error: "base operand '->' has non-pointer type 'student'.
I recently posted a similar question.

It seems that the pointer in this case is to the array. Therefore, the object members are still members of object, not of pointer.

So... x[0].naam
Topic archived. No new replies allowed.