Help C++ Global Array Declaration Error

#include
using namespace std;

unsigned long long int t,A[1000000][1000000];

int main() {
t=2;
A[0][0]=1;
return 0;
}

causes this error:

/home/8XkJo4/ccDOTbwy.o: in function main': prog.cpp:(.text.startup+0x3): relocation truncated to fit: R_X86_64_PC32 against symbol t’ defined in .bss section in /home/8XkJo4/ccDOTbwy.o
/home/8XkJo4/ccDOTbwy.o: in function _GLOBAL__sub_I_t': prog.cpp:(.text.startup+0x27): relocation truncated to fit: R_X86_64_PC32 against .bss’
prog.cpp:(.text.startup+0x45): relocation truncated to fit: R_X86_64_PC32 against `.bss’
collect2: error: ld returned 1 exit status

size of A is too large

1 Like

You can declare a size of atmost 10^7 when declared globally

Globally declared array should have a size less than 10^7.