COMPILER DESIGN

ADVANCED TOPICS IN COMPILER DESIGN

CODE GENERATION FOR OBJECT ORIENTED LANGUAGES

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Where is an array stored in memory?
A
heap space
B
stack space
C
heap space and stack space
D
first generation memory
Explanation: 

Detailed explanation-1: -Where is an array stored in memory? Explanation: Array is stored in heap space. Whenever an object is created, it’s always stored in the Heap space and stack memory contains the reference to it.

Detailed explanation-2: -Solved: Are C arrays stored in the stack or the heap? Edit, for those looking for a quick Answer: All variables and arrays are stored in the stack, unless: Malloc is used, the variable is static, the variable is global.

Detailed explanation-3: -When we declare an array, space is reserved in the memory of the computer for the array. The elements of the array are stored in these memory locations. The important thing about arrays is that array elements are always stored in consecutive memory locations.

There is 1 question to complete.