#include <stdio.h>
const int str[1000] = {0};
int main(void)
{
    printf("arr is %d\n", str[0]);
    return 0;
}
Has the following output:
[-exercises/adam/stack2]:size a.out
   text    data     bss     dec     hex filename
   5133     272      24    5429    1535 a.out
Whereas:
#include <stdio.h>
static int str[1000] = {0};
int main(void)
{
    printf("arr is %d\n", str[0]);
    return 0;
}
Has the following output:
[-exercises/adam/stack2]:size a.out
   text    data     bss     dec     hex filename
   1080    4292      24    5396    1514 a.out
When the array is uninitialized -- it again goes to text segment for "const" and to BSS for "static".
The variable is global and should be accessible from anywhere in the executable it is part of (because of no "static"), but given its a variable I don't know why it is placed in text segment instead of data segment?