What is the max size an array has? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

What is the max size an array has?

24th Feb 2016, 5:59 PM
Ashu Babbar
Ashu Babbar - avatar
2 Answers
+ 1
There *are* limits, though the limits might not be of practical relevance for a beginner programmer or in everyday programming. Every operating system(OS) has a limited address space for every program that is defined by the maximum of memory that can be addressed by the OS (or the machine itself, if you don't have an OS). A 32bit OS can address less memory (not more than 4GB) than a 64bit OS (lots more than 4GB). Also, long before this becomes relevant, the OS might not fulfill a dynamic memory request (via new operator or local variable) as a memory request might break the size limits of the heap or the stack. Furthermore, a physical machine has a limit to its physical memory. Consequencially, an OS will very likely deny a dynamic request, if it exceeds (physical memory + swap space) - (OS memory footprint + memory needed for other programs). That said, these limits rarely become relevant and might mostly be relevant in scientific and high-end programming. So it's in 95% of the cases not relevant (wild guess).
15th Jun 2016, 8:09 PM
Stefan
Stefan - avatar
0
it can be as big as u want it to be
26th Apr 2016, 3:46 AM
Robin Hood
Robin Hood - avatar