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

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

问题描述

什么是一个二维数组和数组的数组之间的区别?

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

我已阅读注释,如<一个href=\"http://stackoverflow.com/questions/7949008/2d-array-manipulation-using-a-pointer-in-c/7949051#7949051\">@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++?

推荐答案

一个2维数组的的定义数组的数组。

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

什么戴夫说的是,在这种情况下,有一个二维数组像这样的定义之间不同的语义:

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;

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

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