in other question I asked how to compile a vector with huge amount of data because I wanted a vector with a dictionary of 107776 entries, and I couldn't compile it.
I solved it thanks to this answer's code:
char const * const dict[] = {"aaron",...};
But now the problem is that when I attempt to access one entry...
cout<<dict[431104]<<endl;
...the program freezes and Windows wants to close it.
Why does it happen? How can I solve it?
Edit: sorry, it was my fault. As tbroberg and Seth Carnegie noticed in this answer, the mistake was that I thought that sizeof(dict)
was the length of the array (instead of sizeof(dict)/sizeof(*dict)
).
Therefore, 431104 was far out of the bounds of the array (its length is 107776).