So for example, I want to compare the name of an int variable to a string, and if the name of the variable is the same as the string, then do certain action.
this makes no sense. if tester is "r1" then it can't be "0"
but, to answer your quest, yes, you can do things like this.
first, you can do it 'legit'...
if(tester == "r1")
something
or
if(tester == "0" && othertester == "r1") //use two variables, one to indicate its r1 we care about?
and second, less legit, there is a macro tokenizer that can turn a variable into its name.
shamelessly stolen off the web this one helps print name / value pairs
#define PRINTER(name) printer(#name, (name))
so in your case I guess you can turn r1 into "r1" but that seems silly for the example: you can just type "r1" there.
this is something you can ONLY do with a macro, and its not really all that useful most of the time but its a great helper for an ENUM that needs to show the user the variable names.