Browse DevX
Sign up for e-mail newsletters from DevX

Tip of the Day
Language: C++
Expertise: Beginner
Nov 7, 2000



Building the Right Environment to Support AI, Machine Learning and Deep Learning

Maximum Number of Characters

I'm reading approximately two million characters into an array. The max number of elements that Borland Turbo C++ 5.02 allows me is not enough. Can I declare this array to be a lot bigger or allocate more memory for this array?

The maximal possible size of an array depends on the OS you're using and the compiler's setting. If it's DOS, you can't allocate such a huge array on the stack, and even dynamic allocation might not succeed. The workaround is to split the array into smaller sub-arrays, each occupying 64k or so, and swap them into a disk file (modern operating systems do that automatically but DOS doesn't). Alternatively, you can redesign your application so that it uses a smaller data structure.

DevX Pro
Thanks for your registration, follow us on our social networks to keep up-to-date