English, asked by shivamtyagi676, 8 months ago

By using a single program explain the advantages and disadvantages of static and dynamic memory allocation.

Answers

Answered by habibqureshii
0

Answer:

We can de-allocate (free/delete) dynamic space whenever we are done with them. Thus we can always have exactly the amount of space required - no more, no less. Disadvantages: As the memory is allocated during runtime, it requires more time.

Answered by NainaRamroop
0

The advantages and disadvantages of static and dynamic memory allocation are explained below by using a single program:

- When the size of the array is known static allocation is done at that compile time.

- the memory size allocated to data is static.

- "ahead of time" are declared by the Global variables such as fixed array.

- The allocation time has efficient execution time is efficient.

- The entire run time of program is the lifetime of static allocation.

- Memory needs to be framed by the user when done is the disadvantage of dynamic memory allocation as it is more likely to turn into bugs that are difficult to find is very important.

- Whenever we are done with that we can delete or free or deallocate dynamic space does the amount of space required remain no more no less.

Similar questions