I am trying to find the difference between static and dynamic memory allocation...

This is **static memory** allocation:

```
#include<stdio.h>
int main(){
int a;
printf("Enter the size of array: ");
scanf("%d",&a);
int arr[a];
for(int i=0;i<a;i++){
    arr[i]=i;
}
for(int i=0;i<a;i++){
    printf("%d\n",arr[i]);
}
return 0;
}

```

**Output:**

```
/tmp/aGaOu4PWEU.o
Enter the size of array: 10
0
1
2
3
4
5
6
7
8
9

```

When we compile and run this we have to enter value of 'a' during run time and size of array arr[] is also set during run time, but how is it compile time???