answersLogoWhite

0

C++ doesn't enforce any limits on array dimensions. Limitations are enforced by the hardware. The first limitation is available memory (including virtual memory). The larger the objects in the array, the fewer elements you can create in memory. The second limitation relates to the maximum integer that can be mapped to a size_t data type (which is dependent upon the architecture), however you're far more likely to run out of memory long before reaching this limit.

For instance, a 32-bit system has 4GB of addressable memory, thus (in theory) can accommodate an array of char with a 4,294,967,295 dimension (assuming an 8-bit char type). However, that would leave no memory for the operating system let alone the IDE, so the maximum would be somewhat lower than 4GB.

On a 64-bit system, a 4GB array of char would be perfectly feasible, even if the system only had 2GB of physical memory, due to the much larger address space available (18,446,744,073,709,551,616 bytes).

However, an array that partially requires virtual memory would be tremendously slow to access due to constant swap file access. Depending on the nature of the array, if it requires more memory than is physically available, it might be better handled via a database or as a random access file stream.

User Avatar

Wiki User

12y ago

What else can I help you with?

Related Questions

What is the array of string in c?

A string in C is stored in a 1 dimension array so an array of strings is simply a two dimension array.


What is the maximum size of array in c?

Platform-dependent.


What is the Maximum limit of array size in c language?

Platform-dependent.


Write a c program to find the maximum value of 25 element in an array?

int findMax(int *array) { int max = array[0]; for(int i = 1; i < array.length(); i++) { if(array[i] > max) max = array[i] } return max; }


Write a c program to find the maximum of two numbers and print out with its position?

maxValue = function (array) {mxm = array[0];for (i=0; i<array.length; i++) {if (array[i]>mxm) {mxm = array[i];}}return mxm;}; i don't know


Columns and rows in c programming?

Do you perhaps mean -- a two-dimensional array? A two dimensional array is nothing more than a one-dimensional array where every element is a one-dimensional array. int matrix[4][5]; C is a row-major language thus the first dimension refers to the number of rows. Here we have declared an array of 4 rows, where each row is an array of 5 elements of type int.


What is the lowest subscript of an array in c plus plus?

The lowest subscript of an array in C, or C++ is 0.


How do you make a C plus plus program that arrange the the numbers in ascending order?

Heres something i whipped up in a hurry... This uses the Bubble Sort method found (related links) #include <iostream> using namespace std; int main(int argc, const char* argv) { int arraysize = 5; //Unsorted array size int array [] = { 5, 3, 4, 2, 1 }; //The array of numbers itself //Display the unsorted array cout << "Before: {"; for (int c=0; c <= arraysize; c++) { cout << array[c]; if (c != arraysize) { cout << ","; } } cout << "}" << endl; //Acctually sort the array int tmp=0; //Used for swaping values for (int loop=0; loop <= (arraysize - 1); loop++) { for (int c=0; c <= (arraysize - 1); c++) //The sort loop { if (array[c] > array[c + 1]) { //Swaps the two values in the array tmp = array[c]; array[c] = array[c + 1]; array[c + 1] = tmp; //Cleanup tmp = 0; } } } //Display the sorted array cout << "After: {"; for (int c=0; c <= arraysize; c++) { cout << array[c]; if (c != arraysize) { cout << ","; } } cout << "}" << endl; return 0; }


How do you declare a string array and add elements to it in C plus plus?

You cannot add elements to a fixed array in C or C++. If, however, the array is declared as a pointer to an array, you can add elements by allocating a new array, copying/adding elements as needed, reassigning the new array to the pointer, and deallocating the original array.


How do you Find the highest (maximum) and lowest (minimum) grades in an array?

You can get many example of"c programming" Reference:cprogramming-bd.com/c_page1.aspx# integer grades


Design an algorithm that accepts an array A of size N all the elements of a should be multiplied by 10 and updates the contents of A copy contents of a into array B display the result from array B?

Start dimension A[N], B[N] For c=1 to N Input A[N] Next For c=1 to N A[N] = A[N] *10 next For c+1 to N B[N] = A[N] Next for c=1 to N print B[N] Next End


How to write a C program to generate Fibonacci series up to 10 elements and store in array?

#include <iostream.h> #include <conio.h> #include <stdlib.h> int swap(int* , int*); int main() { int c=0; int b=1; int max; cout<<"Enter the maximum limit of fibbonacci series = "; cin>>max; if(max>0) { cout<<c<<endl; } else { exit (EXIT_FAILURE); } for(int i=0;i<max;i++) { c=b+c; swap(&b,&c); if(c<max) { cout<<c<<endl; } else { break; } } getch(); return 0; } int swap(int *x,int *y) { int z; z=*x; *x=*y; *y=z; return z; }