I get the segmentation fault when i want to allocate this array and output first element. I know that this element not initialized, but why segmentation fault? Code:
#include <iostream>
using namespace std;
int main() {
unsigned long long adj[1024][1024];
cout << adj[0][0];
return 0;
}
Tested on OSX with(1GB free memory) and on Ubuntu 12.04(with about 15gb free memory).
PS: I was sure that in linux we can allocate big arrays on stack.
Compilers tried:
OSX(clang++, g++4.8.3 -std=g++11), Ubuntu(g++4.8.1)
ERRORS:
OSX:
Segmentation fault: 11
UBUNTU: Segmentation fault