Discussion
Memory allocation using malloc() is done in?
Answer: C
Correct answer: Heap area
malloc takes storage from the heap, a region the program grows at run time. That is what gives the block a lifetime independent of any function: it persists until free is called, whatever returns in the meantime.
The static area holds globals and static variables, laid out before the program starts, and the stack holds automatic variables, reclaimed on return. It is the heap's independence from function lifetimes that makes it the only place a data structure can be built and returned.
No comment is present. Be the first to comment.
Loading…
Post your comment
Please log in or register to post a comment.
Examination Categories
- SSC Exams
- Banking Exams
- Teaching Exams
- Civil Services Exams
- Railways Exams
- Engineering Recruitment Exams
- Defence Exams
- State Government Exams
- Police Exams
- Insurance Exams
- Nursing Exams
- Other Government Exams
- NRA CET
- PG Entrance Exams
- Campus Placement
- MBA Entrance Exams
- CUET and UG Entrance
- Judiciary Exams
- Regulatory Body Exams
- Software Development