@aryan_007 yes we can .
The code is giving Runtime error
But still still it is occupying 1e8 space ,so how is that possible ?
please read this:
The maximum size of an array is determined by the amount of memory that a program can access. On a 32-bit system, the maximum amount of memory that can be addressed by a pointer is 2^32 bytes which is 4 gigabytes. The actual limit may be less, depending on operating system implementation details. I believe that on most 32-bit Linux systems, 1 GB is reserved for the kernel, so the virtual address space of any given application for user data is 3 GB. All the applicationās code and data are mapped into this 3 GB address space, so the amount of contiguous address space available for a single array is even less. Your array amounts to about 2.6 GB, so I am not the least bit surprised that you ran into trouble.
Sir, issese kya samjna tha, i mean 2d array ka maximum size kya ho sakta hai and 1d array ka maximum size kya ho sakta hai, baas ye confusion hai ?
exactly what i have told you above for 2d array
and yes for 1 d array it can vary between 1e6 to 1e7 .
array size 10^7 to 10^8 declared globally(i.e. on heap) is possible.if u declare it in the main or in the functioit goes into the stack which has a smaller size hence your 10^7 array did not work outā¦
this also brings out the difference .