The CPython implementation – the implementation of Python written in C – uses the C language to implement a certain kind of variable lookup that makes Python behave like Python and not like, say, C or BASIC.
So, you can certainly use C or C++ to implement string-named variable lookup. Just don’t expect the compiler to recognize it, because it’s not part of the C/C++ language. The end product – the compiled executable – will support the concept, though.
For example, in C++, using Boost:
std::map<std::string, boost::variant<std::string, int>> _;
_["name"] = "user";
_["index"] = 1938107;
std::cout << _["name"] << _["index"] << std::endl;
Output:
user1938107
You can also make it interoperate with regular variables known to the compiler, if but there are no off-the-shelf classes to help you there.
solved Is it really impossible to make a string into a variable in c++ [closed]