You shouldn't use a void*
in the first place. You can use an std::vector<int>
and have no problems at all:
void getInput(std::vector<int>& list)
{
int qty, large;
cout<<"How many random numbers do you wish to have? ";
cin>>qty;
cout<<"What is the largest number you wish to see? ";
cin>>large;
list.resize(qty);
for(int i = 0; i < qty; i++)
{
list[i] = rand()%(large+1);
}
}
But if you are interested, the reason why it was causing an error is because you were probably dereferencing an uninitialized pointer (if the values in the vectors were not initialized outside of the function).
And finally, if you have access to C++11, please consider dropping rand
for uniformly generating random numbers.