Machine-translated by Google. Questions are authored in English.
Top

Discussion

Where are automatic variables allocated memory?

  • A.heap
  • B.Data segment
  • C.Code segment
  • D.stack

Answer: D

Correct answer: stack

Automatic variables are allocated on the stack: space is reserved when the block is entered and released when it is left, which is what makes their lifetime match the block and what makes recursion possible - each call gets its own frame.

No comment is present. Be the first to comment.
Loading…

Post your comment

Please log in or register to post a comment.