Variable is stored in RAM or What?

ပရိုဂရမ်မာတွေ အမြဲတမ်းလိုလို ထိတွေ့နေရတဲ့ ကုတ်တွေထဲမှာ variable ဆိုတာမပါမဖြစ်ပါ။

နေ့စဉ်နေ့တိုင်း variable တွေတော့ သုံးနေကြတာပဲ။​ ဒါပေမယ့် ခနလေး ရပ်ပြီး စဉ်းစားလိုက်ကြရအောင်။ variable တစ်ခု ကြေညာပြီး အဲ့ variable ထဲမှာ data တစ်ခုခု Store လုပ်လို့ရတာတော့ ဟုတ်ပါပြီ၊ အဲ့ Store လုပ်ထားတဲ့ Data ကို ဘယ်မှာ သိမ်းထားကြတာလဲ?

ကျွန်တော် တို့ ကွန်ပျူတာကို ကြည့်လိုက်ရင် သိမ်းစရာ အဓိက (၂)​ နေရာ တွေ့ရမယ်။​ RAM နဲ့ Harddisk ( may be SSD )

ဒီတော့ ကျွန်တော်တို့ ကြေညာပြီးသိမ်းလိုက်တဲ့ Variable တွေက RAM မှာ သိမ်းလိုက်တာလား?​ Harddisk မှာ သိမ်းလိုက်တာလား?

Which memory stores the values of variables?

RAM memory stores the values of variables .

Random Access Memory is where the computer stores temporary data during program execution. Integers require 2-bytes or 16 bits of storage each. … These numbers are known as memory addresses. A variable reserves one or more addresses in which a binary value is stored.

Variables are usually stored in RAM. This is either on the heap (e.g. all global variables will usually go there) or on the stack (all variables declared within a method/function usually go there). Stack and Heap are both RAM, just different locations. Pointers have different rules.

Written on May 13, 2023