Объясните, пожалуйста, каким образом я могу передать динамический масив в функцию DisplayCountries?
const int n_Country = 2;
struct Country
{
char name[100];
char capital[100];
int population;
double area;
};
int main() {
Country* List;
List = new Country[n_Country];
for (int i = 0; i < n_Country; i++)
{
cout << "Name = ";
cin >> List[i].name;
cout << "Capital " << endl;
cin >> List[i].capital;
cout << "Population " << endl;
cin >> List[i].population;
cout << "Area " << endl;
cin >> List[i].area;
}
}
void DisplayCountries() {
cout << "--------- Result ---------------";
for (int i = 0; i < n_Country; i++)
{
cout << List[i].name << ", " << List[i].capital << ", " << List[i].population << ", " << List[i].area << endl;
}
}
...DisplayCountries(list, n_Country);... void DisplayCountries (Counry *lst, size_t n) { ... }