I need to assign a value to a variable named in a sting variable. Like this ...
int temperature;
int pressure;
int volume;
int variable_value;
char Inbuffer[2048];
printf("%s","Variable List: temperature, pressure, volume");
printf ("%s","Input variable name from list above:");
gets(Inbuffer);
ScanError=scanf("%s\n",variable_name);
....
printf("%s","Input new value for variable:");
gets(inbuffer);
ScanError=scanf("%d", variable_value);
....
// This is what I want to do . . .
// Find a simple way to convert a string representation of a variable name
// to a variable name and assign a value to it.
// For instance, if variable_name=volume and variable_value=250;
// How do I get volume=250 using the string variable_name when
// variable_name is 'volume'?
Would appreciate any help!
:confused: JimH