Pointer to function, what's wrong with this?

Hi, I have this function:

1
2
3
4
5
6
7
void randomgetal(int* willekeurig[])
{
	for (int i =0; i < 3; i++)
	{
	*willekeurig[i] = 2 + rand() % 5;
	}
}


The function is called on this way:
randomgetal(random);


The parameter random is this:
int random[3];

What am I doing wrong? Something is wrong with the pointers here.

Thanks :)

EDIT:
Nvm, I solved it using this way:
1
2
3
4
5
6
7
8
void randomgetal(int* willekeurig)
{
	for (int i =0; i < 3; i++)
	{
	*willekeurig = 2 + rand() % 5;
	++willekeurig;
	}
}


Not sure if there was an easier way though.
Last edited on
you can use willekeurig[i] instead of *willekeurig so you won't need to increase the pointer.
Okay, thank you very much :)
Topic archived. No new replies allowed.