<p>Where are variables in C++ stored?</p>

<p>Inside the RAM or the processor's cache?</p>

Variables can be held in a number of different places, sometimes in more than one place.  Most variables are placed in RAM when a program is loaded; sometimes variables which are declared
```
const
```
are instead placed in ROM.  Whenever a variable is accessed, if it is not in the processor's cache, a cache miss will result, and the processor will stall while the variable is copied from RAM/ROM into the cache.
If you have any halfway decent optimizing compiler, local variables will often instead be stored in a processor's register file.  Variables will move back and forth between RAM, the cache, and the register file as they are read and written, but they will generally always have a copy in RAM/ROM, unless the compiler decides that's not necessary.