数组的最大大小 [英] Maximum size of an array

查看:105
本文介绍了数组的最大大小的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

数组的最大大小是多少?我试图为魔方编辑一个非常大的

数组,例如,数组[3001] [3001],当我运行

程序时,它不会显示数组。我将数组改为105×105

,它运行良好。有没有人知道问题是什么以及我怎么可能可以绕过它?

What is the maximum size of an array? I tried to edit an extremely large
array for a magic square, for example, array[3001][3001], and when I ran the
program, it would not display the array. I changed the array to 105 by 105
and it worked fine. Does anybody know what the problem is and how I could
possibly get around it?

推荐答案

" eggie2486" <例如****** @ twcny.rr.com>写道...
"eggie2486" <eg******@twcny.rr.com> wrote...
数组的最大大小是多少?我试图为魔方编辑一个非常大的数组,例如,数组[3001] [3001],当我运行
程序时,它不会显示数组。我将数组更改为105 b
105,它运行正常。有没有人知道问题是什么以及我怎么可能绕过它?
What is the maximum size of an array? I tried to edit an extremely large
array for a magic square, for example, array[3001][3001], and when I ran the program, it would not display the array. I changed the array to 105 by 105 and it worked fine. Does anybody know what the problem is and how I could
possibly get around it?




问题可能只是你可用的有限数量的存储

程序执行期间。这超出了语言规范,

你需要查阅手册来编写你的操作系统和/或手册

为你的编译器。


通常可以为静态,自动和

动态数组使用不同大小的数组。既然你没有说明你有什么样的数组,那么我认为它是自动的。寻找一个编译器开关,允许你

来控制堆栈大小。 (这与std :: stack模板无关)。

但是请不要问我们,特殊的编译器开关在这里是偏离主题的。


Victor



The problem can be simply a limited amount of storage available to your
program during its execution. That''s beyond the language specification,
you need to consult the manual for programming your OS and/or the manual
for your compiler.

Often different sizes of arrays can be had for static, automatic, and
dynamic arrays. Since you didn''t indicate what kind of an array you had,
I assume it was automatic. Look for a compiler switch that allows you
to control the "stack size" (which is not related to std::stack template).
But please don''t ask us, particular compiler switches are off-topic here.

Victor


这取决于你的电脑的内存大小。

例如,如果你声明了一个数组:int array [3001] [3001]

它需要32bit * 3001 * 3001 = 288M的内存空间。

这样,你可以计算你可以使用的最大阵列数量

根据您的阵列类型和内存大小确定



" eggie2486" <例如****** @ twcny.rr.com> D'è?óê?t

新闻:hz **************** @ twister.nyroc.rr.com ...
It depends on your pc''s memory size.
for example,if your declared an array: int array[3001][3001]
it needs 32bit*3001*3001=288M memory space.
in such way,you can calculate the Maximum size of array you can you use
according
to your array type and memory size.

"eggie2486" <eg******@twcny.rr.com> D′è?óê?t
news:hz****************@twister.nyroc.rr.com...
数组的最大大小是多少?我试图为魔方编辑一个非常大的数组,例如,数组[3001] [3001],当我运行
程序时,它不会显示数组。我将数组更改为105 b
105,它运行正常。有没有人知道问题是什么以及我怎么可能绕过它?
What is the maximum size of an array? I tried to edit an extremely large
array for a magic square, for example, array[3001][3001], and when I ran the program, it would not display the array. I changed the array to 105 by 105 and it worked fine. Does anybody know what the problem is and how I could
possibly get around it?



eggie2486写道:
eggie2486 wrote:
数组的最大大小是多少?我试图为魔方编辑一个非常大的数组,例如,数组[3001] [3001],当我运行
程序时,它不会显示数组。我将数组改为105×105
它工作正常。有谁知道问题是什么以及我怎么可能绕过它?
What is the maximum size of an array? I tried to edit an extremely large
array for a magic square, for example, array[3001][3001], and when I ran the
program, it would not display the array. I changed the array to 105 by 105
and it worked fine. Does anybody know what the problem is and how I could
possibly get around it?




我认为这与它的大小有关由$ / b $ b编译器/链接器分配的堆栈。我认为4KB可能是x86的标准堆栈大小。

我确定你会找到一些用于你正在使用的编译器/链接器的开关

来改变默认的堆栈大小。



I think it is related to the size of the stack allocated by the
compiler/linker. I think 4KB might be the standard stack size for a x86.
I sure you will find some switch for the compiler/linker you are using
to change the default stack size.


这篇关于数组的最大大小的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆