COMPILER DESIGN

TOOLS AND TECHNIQUES FOR COMPILER DESIGN

MISCELLENOUS

Question [CLICK ON ANY CHOICE TO KNOW THE RIGHT ANSWER]
Which kind of memory can grow and shrink dynamically and unexpectedly?
A
Static
B
Stack
C
Heap
D
both b and c
Explanation: 

Detailed explanation-1: -Except statically allocated memory area, both stack and heap memory can grow and shrink dynamically and unexpectedly. Therefore, they cannot be provided with a fixed amount of memory in the system.

Detailed explanation-2: -C dynamic memory allocation refers to performing manual memory management for dynamic memory allocation in the C programming language via a group of functions in the C standard library, namely malloc, realloc, calloc, aligned alloc and free.

Detailed explanation-3: -Heap is used for memory which is allocated during the run time (dynamically allocated memory). Heap generally begins at the end of bss segment and, they grow and shrink in the opposite direction of the Stack.

Detailed explanation-4: -To allocate memory dynamically, library functions are malloc(), calloc(), realloc() and free() are used. These functions are defined in the <stdlib.h> header file.

There is 1 question to complete.