Where are variables store in computer? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 9

Where are variables store in computer?

I want to know if variables are stored in "RAM" or Hard Disk?

27th Jan 2018, 4:29 PM
Goundo
Goundo - avatar
5 Answers
+ 10
Variables are usually stored in Ram. the global variables are stored on the heap and variables declared in functions/methods are stored on stacks. Heap and Stack are both RAM. This is really a complex subject and there are register involved too.
27th Jan 2018, 4:36 PM
madeny
madeny - avatar
+ 5
Anywhere where data can be stored, CPU registers, CPU cache, main RAM, and even the harddrive temporarily. (Operating systems can use swapping to save physical RAM space). In short the answer varies heavily, and depends on the compiler, operating system, language, and hardware.
27th Jan 2018, 4:57 PM
aklex
aklex - avatar
+ 2
RAM
28th Jan 2018, 12:09 PM
Rahul Maddesia
Rahul Maddesia - avatar
+ 1
RAM
27th Jan 2018, 7:57 PM
sam
- 3
vikram is cool and good
30th Jan 2018, 8:36 AM
Vikram Kumar