In C, how do you use the value of a variable or a field within a struct as the name of a variable or field within a struct to be used in a program?
i.e.:
char variable_name[];
struct_x.value_of_variable_name = 1;
// assuming the variable struct_x.value_of_variable_name is an int
You can’t. Variable names exist only at compile-time.
You could emulate this behaviour manually by creating a lookup table (that maps a string to a pointer, for instance), but there is no language support for this.