5 AnswersNew Answer
The stack is generally used to store all of the stuff you create at compile-time such as local variables, the parameters you pass in a function and more... The heap is mainly used to store all of the stuff you create at run time, there is always a variable that points to the dynamic space and this is what we call a "pointer". More: https://www.quora.com/What-is-the-difference-between-the-stack-and-the-heap
You're just a beginner, not ignorant, this is a legit question, LOL. Basically the allocated space depends on the variable itself, it can be stored mainly in CPU registers or into the stack. The stack is stored in computer RAM. CPU registers are way faster but limited. Note. There's also the heap where it's stored the dynamically created space, however the variable that points to that space is always located into the stack.
what is the defferent between stack and heap and what is the realtive between them and Ram
thanks for helping Maz
Java and JS =???