Home » questions » What the "Stack" and the "heap" are.?

What the "Stack" and the "heap" are.?

2006-08-06 21:46:20, Category: Programming & Design
Okay trying to remember this from my C++ class.. but it been a while.. the "stack" is where all the variables that are declared and initialized before runtime are stored in the RAM right? and the "heap" is where all the variables created or initialized at runtime are stored in RAM.. I am probably so wrong, but uhm how close was I?

Answers

  1. anonymous

    On 2006-08-06 21:56:33


    That sounds right. According to the dictionary: heap (n) 1. An area of memory used for dynamic memory allocation where blocks of memory are allocated and freed in an arbitrary order and the pattern of allocation and size of blocks is not known until run time. Typically, a program has one heap which it may use for several different purposes. and stack (n): Computer Science. A section of memory and its associated registers used for temporary storage of information in which the item most recently stored is the first to be retrieved. Good luck!
  2. up.tobat

    On 2006-08-06 21:51:58


    I think stack is Pamela Anderson and heap is what she drove before she got famous.
  3. JKP

    On 2006-08-06 21:54:38


    That sounds right to me, actually. But I think uptobat deserves the 'best answer' for this one.