How is it determined ? Does this depend on the compiler/Architecture/Host system ?
Example:
int array[0x8000000000000000];
For this line GCC outputs the following on a x86_64 bit system:
Error "size of array 'array' is too large".
By static array, I assume, you mean a fixed length array (statically allocated, like int array[SIZE], not dynamically allocated). Array size limit should depend on the scope of the array declared.
ulimit -a to view and ulimit -s STACK_SIZE to modify the stack size.static int array[SIZE]), again, the array is stored in DATA or BSS section (based on whether the array is initialized or uninitialized respectively). The DATA and BSS section size are determined by underlying OS.PTRDIFF_MAX, so even though you can mmap more than 2GB in a 32-bit process, you can get undefined behaviour when using it.
statickeyword?sizeof(int) == 2, then the maximum size of array you could use isint a[32];('size of memory / size of one element of an array') and then you'd not have any other variables available. But 64 bytes of memory should tell you that the maximum possible size would be 64, but each number would have to be a 1-byte number (signed charorunsigned char). In general, in the absence of virtual memory, if the memory size is M and the size of an item in the array is S, the maximum array size is M / S.