I am reading the solidity docs here and I seem to be struggling to understand the following.
Data locations are important because they change how assignments behave: assignments between storage and memory and also to a state variable (even from other state variables) always create an independent copy. Assignments to local storage variables only assign a reference though, and this reference always points to the state variable even if the latter is changed in the meantime. On the other hand, assignments from a memory stored reference type to another memory-stored reference type do not create a copy
1)Isn't a state variable always stored in the storage? So what does the above mean by assignments between storage and memory and also to a state variable?
2) What exactly is a local storage variable?
pragma solidity ^0.4.0;
contract C {
uint state_variable; // same as global storage variable
function test() returns uint{
uint local_variable = 10; //same as local storage variable
return local_variable * state_variable;
}
}
Is my understanding above correct? Is there a way to see if these variables are in memory or storage , I am looking at the disassembled op codes in remix IDE but unable to make it out.
Thanks!