I have:
const char *ptr = "int";
If I have to declare using ptr:
int a;
ptr can point to anything arbitrary char, string, <anythihg>.
I have to delcare a variable of that type what ptr is pointing at.
Is it possible?
I have:
const char *ptr = "int";
If I have to declare using ptr:
int a;
ptr can point to anything arbitrary char, string, <anythihg>.
I have to delcare a variable of that type what ptr is pointing at.
Is it possible?
No. C++ is not an interpreted language. "int" has a meaning to the compiler, but at runtime there's nothing which understands "int".
It is advisable that you choose a language based on the way you'd like to express yourself.
What you have described is not a feature in standard C, and any extensions that you have to rely upon will lock you into a particular vendor, in which case it they might decide at some point to stop supporting it... What a mess that would be, right?
In the realm of C++, you might find helpful templates, decltype, the auto keyword, or potentially other options?