Tried following code on 32 bit ubuntu virtual machine:
static int a[0x1f0fff];
cout << &a[0x600000] << endl;
cout << &a[0x800000] << endl;
cout << &a[0x8fff00000] << endl;
0x984a140
0xa04a140
0x7c4a140
Really confused that the address do not keep increasing.
The array located in heap, and what printed is virtual memory address. Is it because that it exceeds virtual memory space?
Besides, according to another answer, the last two line codes are indexing into a part of memory that is not allocated. Why is there no segfault reported?