How many characters i can store in a character array while i am having a ram of 1 GB.
Printable View
How many characters i can store in a character array while i am having a ram of 1 GB.
That depends on your OS and compiler.
If you're using crusty old turbo C, then 64K is your limit no matter how much RAM you have.
But a more modern combination which allows you to use virtual memory might allow you to store more than your physical memory.
On windows (32-bit), the maximum limit would be 2GB with default settings, 3GB if you apply the /3GB switch in your boot.ini - of course, that would make it REALLY slow. If you want reasonably fast access to the content of a char array, limit it to about 80% of RAM-amount (unless you have other large applications).
Also, if you use local variables on the stack, you don't have that much space, the default stack is fairly large, but not that many megabytes!
--
Mats
One megabyte by default in Windows. Subtract from that all the space normally needed, and you end up with a max length of perhaps 800-900k, if the program does nothing else.
Under no circumstances will you be able to use more than 3 gigs of continuous memory in 32-bit Windows, and that requires special tricks. By default, you have 2 gigs of freely available address space. Furthermore, memory fragmentation means that you will probably not be able to allocate all the memory there is into a continuous block.