In C runtime environment, which one of the following is stored in heap?
2026
In C runtime environment, which one of the following is stored in heap?
- A.
A static variable declared inside a function
- B.
An array of integers declared inside a function
- C.
A dynamically allocated array of integers created using malloc() function call
- D.
Return address of a function
Attempted by 206 students.
Show answer & explanation
Correct answer: C
The correct answer is C — A dynamically allocated array of integers created using malloc() function call.
In C runtime memory organization:
Heap → stores dynamically allocated memory using
malloc(),calloc(),realloc()Stack → stores local variables, function parameters, return addresses
Data segment → stores static and global variables
So:
A → Static variable → Data segment
B → Local array inside function → Stack
C →
malloc()allocated array → Heap ✅D → Return address → Stack