How to pass an array of struct as a function parameter?
This is not working:
struct Person
{
char* name;
int age;
Person(char* name, int age)
{
this->name = name;
this->age = age;
}
}
struct XYZ
{
int count;
Person* people[];
XYZ(int count, Person* people[])
{
this->count = count;
this->people = people; // << Error here.
}
}
void ABC()
{
Person* people[] = { new Person("Tom", 18), new Person("Jacob", 25) };
XYZ* xyz = new XYZ(2, people); // << Error
}