Generation of variable names from strings | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 5

Generation of variable names from strings

My question is if is possible to generate variables within the execution of a program. This kind of behaviour i think can solve many problems when the kind of input data is unknown. Generating variables from strings is a way to name this new variables. For example, generate variables with the form "var_n" where n is iterated. Is possible to do this on C++? I supose that isn't possible, but some times there are back doors. I know this can be solved with arrays, but this is interesting for me.

24th Aug 2016, 11:39 PM
Néstor
Néstor - avatar
1 Answer
+ 2
Very interesting point indeed, im sorry im not sure on the answer either
26th Aug 2016, 7:40 AM
Frank
Frank - avatar