I am now reading chapter 6 of the book Expert C Programming and very curious about the size of the data segment.
I wrote 3 programs to see the difference of the data segment.
My platform is MacBook Pro, OS X 10.8 and I use the command clang xxx.c
to compile the code.
int main()
{
int i, j;
return 0;
}
__TEXT 4096 __DATA 0
int arr[10000];
int main()
{
int i, j;
return 0;
}
__TEXT 4096 __DATA 40960
int main()
{
int i, j;
int arr[10000];
return 0;
}
__TEXT 4096 __DATA 4096
Why are the all three sizes different from each other?