在C语言中,数组 [英] In C Language,Arrays

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

问题描述

可以在数组中声明的最大字节索引大小是多少?

What is the maximum index size in bytes can be declared in arrays?

推荐答案

实际上,如果编译器是32位或64位,则定义了限制. ..
理论上,一台32位计算机允许4gb,但是由于操作系统有其自身的限制,其他程序已经在使用内存并且操作系统本身和一个阵列使用单个块,因此您将永远无法分配那么多的内存.记忆.因此,即使您的计算机仍然有可用内存,如果内存碎片,也很可能无法分配1gb内存(例如).

在64位计算机上,该值约为40亿乘以4gb ...我不知道它的名字是什么,但是计算机有多少内存?
In fact the limit is defined if the compiler is 32 bits or 64 bits...
In theory a 32 bit computer allows for 4gb, but you will never be able to allocate that much as the operating system has its own limit, memory is already in use by other programs and the operating system itself and an array uses a single block of memory. So, even if your computer still has free memory, it may be simple unable to allocate a 1gb memory (for example) if the memory is fragmented.

On 64 bits computers, the value is something like 4 billion times 4gb... I don''t know what''s the name for that, but then how much memory do the computer have?


最大值取决于计算机.在具有32GB内存的计算机上,可以创建比在具有4GB内存的计算机上更大的阵列.
The maximum depends on the computer. On a computer with 32GB memory, you can create bigger arrays then on a computer with 4GB memory.


这取决于存储方法.

在堆栈上使用数组时,大小受应用程序的堆栈大小限制.

在堆上,大小受虚拟内存限制.

对于堆栈和堆,它是声明或分配时实际可用的(空闲)内存.
It depends on the storage method.

When using arrays on the stack, the size is limited by the stack size of the application.

On the heap, the size is limited by the virtual memory.

For stack and heap, it is the actually available (free) memory when declaring or allocating.


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

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