I want to change the variable names dynamically, on the runtime. I want to create five arrays whose name would be determined on the runtime. How can we do?
You cannot change variable names at runtime. Use a std::map instead.
How to use ?
Could you please guide?
map<string, vector<int>> m; m["hello"].push_back(1); m["worlxd"].push_back(2); // now renaming worlxd to world (overwriting previous "world"): auto it = m.find("worlxd"); m["world"] = std::move(it->second); m.erase(it);
This topic was automatically closed 14 days after the last reply. New replies are no longer allowed.