I want to be able to do the following:
I have an array of strings containing data types:
string DataTypeValues[20] = {"char", "unsigned char", "short", "int"};
Then later I would like to create a variable of one of the data types at runtime. I will not know at compile time what the correct data type should be.
So, for example, if at runtime I defined a variable x, which should be of type int:
DataTypeValues[3] x = 100;
Obviously this will not work, so how can I do something like this?
c ++
Blade3
source share