Thanks vVv but I couldn't get any of that to work Here is the code that I'm currently working on. I deleted some irrelevant parts:
Code:
int playgame(int *dicearray, int ndice)
{
int i, randomnumber, getrandomnumber(), *rdarray = NULL;
rdarray = dicearray = (int*)malloc(ndice * sizeof(int));
for (i=0; i<ndice; i++)
{
dicearray[i] = 0;
}
for (i = 0; i < ndice; ++i)
{
randomnumber = getrandomnumber();
dicearray[i] = randomnumber;
}
for (i = 0; i < ndice; i++)
printf("%d ", dicearray[i]);
free(dicearray);
dicearray = NULL;
for (i = 0; i < ndice; ++i)
{/*prompt user */scanf("%d", &rdarray[i]);
return *rdarray;
}
// so we are returning ndice number of integers. In main we have:
int main(void)
{
int playgame(int *dicearray, int ndice);
int *dicearray = NULL;
int finalarray[5] = {0}, i;
srand(GetTickCount());
*finalarray = playgame(dicearray, 5);
for(i = 0; i < 5; i++)
printf(" %d", finalarray[i]);
}
If it was working the way I hoped it would the 5 random numbers would be printed followed by the user's choice but instead only the first element of rdarray is printed. Obviously I'll be doing more useful things once I've got the concepts right. I tried incorporating some of vVv's suggestions but just got errors, my fault I'm sure .