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

问题描述

我想知道如何可变长度数组管理(保存在栈上才能有变长数组哪些额外的变量或数据结构)。

I would like to know how a variable length array is managed (what extra variables or data structures are kept on the stack in order to have variable length arrays).

非常感谢。

推荐答案

这只是一个动态大小的数组(依赖于实现的,但最常见的堆栈上)。这是pretty很像的alloca 在旧时代,不同之处在于的sizeof 将返回的实际大小数组,这意味着数组的大小也必须存储在某个地方(实现相关的为好,但可能在栈上也是如此)。

It's just a dynamically sized array (implementation-dependent, but most commonly on the stack). It's pretty much like alloca in the old days, with the exception that sizeof will return the actual size of the array, which implies that the size of the array must also be stored somewhere (implementation-dependent as well, but probably on the stack too).

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

08-21 20:28