Computer Science, asked by farzamguru, 8 months ago

int a[] = {1,2,3,4,5}, This is
static allocation
dynamic allocation?

Answers

Answered by Rushilmadia
15

Answer:

it is dynamic allocation

Explanation:

this is the answer of your question

Answered by syed2020ashaels
0

int a[] = {1,2,3,4,5} – Static Memory Allocation is right.

Explanation:

  1. Static memory is allocated at the time of compilation so it can’t be changed at the time of execution.
  2. Our program is executing so, we can not increase or decrease the size of allocated memory because it is fixed .
  3. This is an advantageous to use in the case our requirement because it is fixed.
  4. But when our requirement is dynamic so, the allocation size needs to be changed as per our requirement .
  5. At time of compilation or execution than we prefer dynamic memory allocation over static memory allocation.

Example :

  • Dynamic Allocation:

memory allocated using malloc()

int *ptr;

  • Static Allocation:

Array

int arr[10] ==>

Project code #SPJ2

https://brainly.in/question/42049527?referrer=searchResults

https://brainly.in/question/22887649?referrer=searchResults

Similar questions