Login
Remember
Register
Ask a Question
What is static memory allocation and dynamic memory allocation?
0
votes
asked
Jan 12, 2024
in
C Plus Plus
by
GeorgeBell
What is static memory allocation and dynamic memory allocation?
c-interview-questions-answers
Please
log in
or
register
to answer this question.
1
Answer
0
votes
answered
Jan 12, 2024
by
GeorgeBell
Static memory allocation:
Memory allocation which is done at compile time is known as static memory allocation. Static memory allocation saves running time. It is faster than dynamic memory allocation as memory allocation is done from the stack. This memory allocation method is less efficient as compared to dynamic memory allocation. It is mostly preferred in the array.
Dynamic memory allocation:
Memory allocation done at execution or run time is known as dynamic memory allocation. Dynamic memory allocation is slower than static memory allocation as memory allocation is done from the heap. This memory allocation method is more efficient as compared to static memory allocation. It is mostly preferred in the linked list.
...