二维数组与数组数组 [英] 2D array vs array of arrays

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

问题描述

二维数组和数组数组有什么区别?

What is the difference between a 2D array and an array of arrays?

我已阅读评论,例如 @Dave's,这似乎区分了两者.

I have read comments, such as @Dave's, that seem to differentiate between the two.

如果他使用二维数组或指向数组的类型,而不是数组的数组,这会中断.– 戴夫

This breaks if he's using 2d arrays, or pointer-to-array types, rather than an array of arrays. – Dave

我一直认为两者都指的是:

I always thought that both referred to:

int arr_arr[][];

<小时>

@FutureReader,您可能希望看到 如何在 C++ 中使用数组?


@FutureReader, you may wish to see How do I use arrays in C++?

推荐答案

二维数组定义为数组的数组.

A 2 dimensional array is by definition an array of arrays.

Dave 所说的是,在这种情况下,像这样的二维数组定义之间存在不同的语义:

What Dave was saying is that in that context, there are different semantics between the definition of a 2D array like this:

int x[][];

这个:

int *x[];

或者这个:

int **x;

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

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