After calling function the amount_of_people, the variable n remains unchanged. I verified this by outputting the variable after the function call. Do I need a pointer n to function as argument?
int main(){
srand(time(NULL));
bool Appworks = true;
size_t n;
do {
amount_of_people(n); // Entering amount of people HERE! STUCKED HERE.
if (n >= 1) {
DataBase *first = new DataBase[n]; // Creating dynamic structure-array
inputData(first, n);
output(first, n); // Output of entered data
freeUp_memory(first); // Clearing dynamic-alocated memory engaged by early-created pointer
}
else cout << "Error! Wrong amount of people!" << endl;
} while (Appworks);
system("PAUSE");
return 0;
}
Function declaring:
unsigned amount_of_people(int n) {
cout << "Enter how many people u want to enter" << endl;
cin >> n;
return n;
}
I would appreciate any help and explanation(!) Thanks for your attention.