There is any max size for an array? I mean elements, not memory allocation.
There is any max size for an array? I mean elements, not memory allocation.
Implementation defined. If you need a huge array you should probably allocate it dynamically.
As far as I know there are no arbitrary bounds on the number of array elements, only restrictions imposed by the amount of memory available.
Look up a C++ Reference and learn How To Ask Questions The Smart WayOriginally Posted by Bjarne Stroustrup (2000-10-14)
If you used very large arrays on the stack, in multiple functions that call one another, you could overflow the stack.
..... and on how it is indexed.Originally Posted by laserlight
If the size of a pointer is 32 bits (which is typical on 32 bit operating systems), you are limited to an array size that cannot exceed 4294967295 (or so) BYTES. Which means your array size is often limited to 4294967295/(sizeof(type)) elements.
What a drag . . . .
dwk
Seek and ye shall find. quaere et invenies.
"Simplicity does not precede complexity, but follows it." -- Alan Perlis
"Testing can only prove the presence of bugs, not their absence." -- Edsger Dijkstra
"The only real mistake is the one from which we learn nothing." -- John Powell
Other boards: DaniWeb, TPS
Unofficial Wiki FAQ: cpwiki.sf.net
My website: http://dwks.theprogrammingsite.com/
Projects: codeform, xuni, atlantis, nort, etc.
Yes, if you reach array size limits, your algorithm needs redesigning