I am trying to create an array of pointers. These pointers will point to a Student object that I created. How do I do it? What I have now is:
Student * db = new Student;
But each element in that array is the student object, not a pointer to the student object. Thanks.
Student** db = new Student*; // To allocate it statically: Student* db;
#include <vector> std::vector <Student *> db(5); // in use db = & someStudent;
The advantage of this is that you don't have to worry about deleting the allocated storage - the vector does it for you.