ugh thinking about it , the program when a variable is declared it will request a memory location based on its type (size in bytes) , it will then return a pointer from this , now to use this it is a bit complicated , generally the address when in use will be stored within cache when possible , however if not the location of a second set of memory in rams location will be stored in the cache , this is then accessed when it is required. Honestly its all handled for you , I wouldnt go around trying to figure it out , its painful , its long and its really really strenuous to understand the principality , I however will gladly explain how the circuit works :D.