title: .NET - Function variables stored on heap or stack in address space?
body: <p>I encountered the following question in an exam:</p>
  
  <blockquote>
    <p>When a program calls a function, in which type of data structure is
    the memory allocated for the variable in that function?</p>
    
    <ol>
    <li>HEAP</li>
    <li>QUEUE</li>
    <li>LIFO</li>
    <li>STACK</li>
    </ol>
  </blockquote>
  
  <p>According to the test, HEAP is the correct answer, although I selected STACK.</p>
  
  <p>Can someone fantastic person out there please explain why?</p>
  
  <p>Thanks in advance.</p>