Hello Im trying to fill my array with random numbers from 1 to 50 using a pointer. When I try to do this the program crashes. This is the declaration.
populate(arraySize, numArray);
and the code
void populate(int size, int *ptr)
{
int counter = 0;
srand(unsigned(time(0)));
while (counter < size++)
{
ptr[counter] = (rand() % 50) + 1;
counter++;
}
}
There are no errors with the code and it runs it just crashes when this method is called