I'm wondering if it's possible to get access to a variable through its memory adress in C. For example, I create a variable "aa", then I print its memory adress through printf and &aa ... Assume that its adress is 12345. Is there a way to get the variable by only using 12345 and not pointers, like that :
printf("%d", 12345);
By this way, I would like that the instruction print "aa".
Sorry if it's not clear, I will show you with the code:
int main()
{
int aa=1; //assume its adress is 12345
printf("%d", 12345); // I want to use 12345 as parameter to print the variable
}
Thank you very much.
aa
? This is not easy or even not possible. Variable names are processed by the compiler and linker but do not become part of the built binary code except (optionally) as debugging information.