About Me

CS201 GDB 1 Solution Spring 2021

 CS201 GDB 1 Solution Spring 2021

Static Memory Allocation:

The compiler allocates static memory for the declared variables. Memory is allocated during compilation. During program execution, you cannot change (add/delete, update etc.)


Dynamic memory Allocation:

Dynamic memory allocation in C/C++ refers to performing memory allocation manually by programmer. Dynamically allocated memory is allocated on Heap and non-static and local variables get memory allocated on Stack (Refer Memory Layout C Programs for details).

This all discussion tells us:

For a given scenario, static memory allocation is the best because:

We have limited resources and we want precise resources.

We fix the memory location at every step to make a new product.

We never want any memory changes during program execution.

When we repair the memory, we can effectively manage our limited resources.

Our automotive industry is entirely automotive industry. So we never want the memory allocation to change during program execution.

Data cannot be added or deleted.

Post a Comment

0 Comments