DIGIT-ARC read-only archive · snapshot: July 23, 2026

variable names of c/cpp

4 posts · originally from https://geek.digit.in/community/threads/variable-names-of-c-cpp.106532/

arpanmukherjee1
arpanmukherjee1 Original post #1
Jan 13, 2009 at 1:13 PM
hello people,

I was thinking about :rolleyes: pointers that would retrieve the variable name and NOT the value....
i know that after compiled the prg does not have any var name.
but if i want to write a prg like

int a=2,b=3,sum;
sum=a+b;
cout<< THE VAR NAME "sum" <<sum;

even if the program is compiled int he debug mode
basically want to understand how var names are stored in c/c++;
dheeraj_kumar
Jan 16, 2009 at 2:50 AM
basically want to understand how var names are stored in c/c++;

Its very simple to understand. Variable names are NOT stored in the compiled program. Its all memory locations. So you cant do what you want to do.
Faun
Faun #3
Jan 16, 2009 at 3:01 AM
Compiler optimizations + Theory of Computation
A
Jan 26, 2009 at 1:37 PM
Variable names are only programmer's reference for the memory location of the same....