#include <iostream>
#include <string>
using namespace std;
struct record {
string C0;
string C1;
string C2;
};
int main()
{
record param;
param.C0 = "heading1";
param.C1 = "heading2";
param.C2 = "heading3";
string key = "CO";
string data = param.C0;
cout << "DATA: " << data << endl;
return 1;
}
Is it possible to replace 'C0' with the variable 'key'?
ie:
string data = param.??key??; // where key is interpolated to 'C0'.