+ 1
So what does variables do? (In relistic situation)
3 ответов
+ 7
A variable is essentially a memory location (literally an address in your RAM) that you give can a name and refer to by its name rather than its memory address.
int i = 0;
This line of code asks the system for a free memory location capable of storing a 32bit integer and assigns its value to 0.
I hope this helps.
+ 2
They're used when you don't know what their value's gonna be (e.g. when using if or switch) or when you need to use some value often (e.g. content from a file, which you would otherwise have to read every time you need that data).
Look around on the playground and you'll see.
0
more information...
the framework predict when is possible free memory with GC (garbage collector), If the variable is not use on the context...