Size of array

In general what is the maximum size of array one can declare array of in solving any problem so as to avoid run-time error?Does it depends on language or it is independent?

Yes, it is language dependent. The maximum size of array you can declare is 10^6(generally in c or cpp)

1 Like

actually its around 10^(6.6) . I declared an array of size [1<<22] (10^6.6 approx) and it worked.

1 Like

@fauzdar65,thanks for answering the question.But can you please explain what is β€œ<<” in 1<<22.I have encountered this many times before but I don’t know why it is used and where to use this.

<< is a left bit shift operator. 1 is 0000…31 times then 1 in binary(int is 4 byte-> 32 bits ). so you can do upto 1<<31 to shift the 1 to the left most bit to get 2^31