The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
+11 votes

Which languages necessarily need heap allocation in the runtime environment?

  1. Those that support recursion.
  2. Those that use dynamic scoping.
  3. Those that allow dynamic data structure.
  4. Those that use global variables.
asked in Compiler Design by Veteran (101k points)
edited by | 1.4k views
same Q appeared in ISRO 2017 dec ..

2 Answers

+24 votes
Best answer
Those that allow dynamic data structure.

malloc etc uses memory from heap area.
answered by Boss (11.5k points)
edited by
Why not option A ,because during recursion the stack gets overflowed and hence we need memory from the heap for variables?
+4 votes


 Heap allocation is needed for dynamic data structures like tree, linked list, etc

answered by Active (4.4k points)

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true

39,849 questions
46,817 answers
59,072 users