callbyreference between functions
I have the following code:
void zufallszahl()
{
int zufallbonus
srand(time(0));
zufallbonus = (rand () % 5);
}
void berechnen(int *p_bonus)
{
zufallszahl();
spieler.energie =+ *p_bonus;
}
I want *p_bonus(line 10) to point to zufallbonus(line 3). How can I achieve that with two different functions? So far I only had to deal with variables, which where defined in the main-function and I would simply point to them with a function. This time the variables are in two seperate functions.
Edit: callbypointer ofc
Posted Feb 21, 2016, 9:21 PM UTC · edited
15