Hello,
I'm want to set up a function that, based on the string and an int argument that is given to it, will set an an int variable to the given value. The int variable is already declared, so the only thing I need to do is assign a value. But I have no idea what would the syntax for that be!
Here's a pseudo-code example:
int var1, var2, var3;
void setVariable (char *variableName, int variableValue)
{
// code to set the variable, which is passed via variableName, to variableValue
}
So for example, if I call the function with the following - setVariable ("var1", 2);, I'd want to set the variable var1 to the value of 2.
But could someone point me to how might I call the proper variable and assign the value?
Thank you.