I am trying to understand how memory is managed in a C program. I know that there are the following segments in memory:

1. Initialized Data segment
2. BSS
3. Stack
4. Heap
5. Code

Now consider the following program:

```
#include <stdio.h>

int main(){
    int arr[4] = {1,2,3,4};
    int x = 10;

    printf("Hello World!");
}

```

In the above program,both arr and x are locally declared within the main function. I thought that this would mean that they would both be allocated space on the function stack.
However, when I ran the size command on linux, I found out that the array is actually being allocated space in the data segment.

I have searched for this online but have found conflicting information. Some answers say that all locally declared variables should go to the stack while others say that the array should go on the heap. I think the array would go to the heap in case I was dynamically allocated memory using malloc, which is not the case here in this example.