Has the address of var a changed?

has var address changed?

Mar.25,2021

the answer is "I don't know".

if these two pieces of code are as you wrote,

 

it can be understood that a variable is the data space in its scope. If the data corresponding to the variable is the original type data, the data itself is saved, and if it is the data of the reference type, the address of the data in heap memory is saved.

if the variable is declared as a constant (const), its stored value will no longer be changed. This value is the original type data itself or the address of the reference type data, so if the constant holds an object, in fact, the properties of the object can be changed, but the address of the string of objects stored in the constant cannot be overwritten.

Menu