To further confuse you, the volitile keyword can be used to force the compiler to place something that it might be tempted to ignore or use a register for in ram. For example
Code:
int max = 8;
for(int i=0; i < max; ++i) ...
here, as long as the compiler sees that max is never modified in the body of the for loop the compiler might very well simply compare i to 8 at every step of the loop, and might even unroll the loop for you (duplicateing the body of the loop and loop over both 4 times)
volitile int max = 8;
forces the compiler to name a location in ram "max" and read this location every time through the loop. Normally we don't care where things live, this is exactly the reason we are using a compiler rather than writing assembly language really, computers are really good at making these sorts of decisions.