Is there a way to read the function parameter as the exact name passed in c++?

  c++, function, parameters

For my program(c++), I need to read one of the function parameter as it is given while calling the function, for example:

void foo(int arg)
{
// I need to read the "arg" paramater here, not its value but the exact thing passed while calling the "foo" function
}

for example:
int bar = 10;
foo(bar); // I want to read "bar" string

One of the alternate option I can see is make two parameters and call the function like:

foo(bar, "bar");

I’m a beginner in c++, so it may be a silly question…

Source: Windows Questions C++

LEAVE A COMMENT