I am doing a school assignment and don't know how to proceed without knowing how to do what I asked in the title. I was given code (by my prof) to run and print a dice roll (1-6).
void showDice (int num) {
int diceRoll;
srand(time(NULL));
diceRoll = (rand() %6) +1;
printf("%d\n", diceRoll);
}
I know how to call it in the main function ( showDice(0); ) and that prints it out. But I need to know how to get it as an int (or another variable) so that I can add it to a total (or counter) variable.
Thanks