A C++ function that could read the name of a variable?

Hello guys,

Suppose I have defined two variables, say, int dollar, cents; dollar=5; cents=3 or something.

Is there any built-in function XXX in C++ that I could somehow output the name of the variable like below?

cout << XXX(dollar) << dollar << " and " << XXX(cents) << cents;

Something like that?

Thanks.

Bosco
This is not possible in C++, as the language is not reflective. Once the program is compiled, the variables themselves don't even exist anymore, so something like that doesn't make sense.
No there is no such a function in C/C++.
oh ok thanks all
I am not sure whether it has to do anything with the subject of this post, but it is a bit of the same: is it possible that the user puts in a name, which is then used as a class object?
Topic archived. No new replies allowed.