if you don't want to pass it as a parameter then you have to ensure that the variable is in the global scope which is not a very good idea .
EDIT: throughout the player function I only used r, but not specifically ROCK, PAPER or SCISSORS
if you had passed a param this would be fine but if you want to use global scoping then you'll have to substitute the r with a specific value one that can be evaluated at compile time.
you just create a global variable with an enum value...
1 2 3 4 5 6 7 8 9 10 11
enum Resource { ROCK = 1, PAPER = 2, SCISSORS= 4};
Resource item=PAPER;///global variable
//or
Resource item=Resource::PAPER/// if you turn to strongly typed enums
void* player(void* av) {
///use the variable here
///....
}
whereas if you passed the param r the compiler could determine for you the exact value of Resource obj.
you could use it if it were a param because the compiler would do the type checking stuff and value deduction for you, if you want to use a global variable instead then having a variable r with no value would result to an undefined behavior.