Home
Recent Q&A
Java
Cloud
JavaScript
Python
SQL
PHP
HTML
C++
Data Science
DBMS
Devops
Hadoop
Machine Learning
Azure
Blockchain
Devops
Ask a Question
What is static memory allocation and dynamic memory allocation?
Home
C Plus Plus
What is static memory allocation and dynamic memory allocation?
0
votes
asked
Jan 12
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
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.
Related questions
0
votes
Q: What is Dynamic memory allocation in C? Name the dynamic allocation functions.
asked
Jan 6
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: What is dynamic memory allocation in C Language?
asked
Mar 12, 2020
in
C Plus Plus
by
rahuljain1
#dymanic-memory-allocation
0
votes
Q: What is the difference between global int and static int declaration?
asked
Jan 4
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: What is static memory allocation in C Language?
asked
Mar 12, 2020
in
C Plus Plus
by
rahuljain1
#c-language-static-memory-allocation
0
votes
Q: What is memory leak? Why it should be avoided
asked
Jan 11
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: What are dangling pointers? How are dangling pointers different from memory leaks?
asked
Jan 6
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: What are local static variables? What is their use?
asked
Jan 11
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: What is the use of static variables in C?
asked
Jan 11
by
GeorgeBell
c-interview-questions-answers
0
votes
Q: Describe about storage allocation and scope of global, extern, static, local and register variables in C Language?
asked
Mar 10, 2020
in
C Plus Plus
by
rahuljain1
#c-language-variables
#c-language-extern
#c-language-register
0
votes
Q: What is the difference between getc(), getchar(), getch() and getche().
asked
Jan 12
in
C Plus Plus
by
GeorgeBell
c-interview-questions-answers
...