我们所说的“尺寸"是什么意思?在谈论数组时?" [英] What do we mean by "dimension" when talking about arrays?"

查看:61
本文介绍了我们所说的“尺寸"是什么意思?在谈论数组时?"的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

在谈论数组时,维"是什么意思?

What do we mean by "dimension" when talking about arrays?

我了解这个主意.但是答案是什么?

I understand the idea. But what would be the answer?

例如 int array [5]; 我知道,这是一维数组.索引中有1个下标.但是为什么将其称为一维数组呢?为什么不使用1个下标数组?

For example, int array[5]; I know that, this is a 1D array. It has 1 subscript in the index. But why is it called a 1 Dimensional array? Why not 1 Subscript array?

推荐答案

数组的维数"是指定数组的单个元素所需的索引或下标的数量.

"Dimension of an Array" is the number of indices, or subscripts, that you need in order to specify an individual element of the array.

尺寸和下标可能会造成混淆.下标是一个数字(或另一种类型的关联密钥),而维度是对可接受密钥范围的描述;您需要为数组的每个维度添加一个下标.

Dimensions and subscripts may be confusing. Subscript is a number (or another type of associative key), while dimension is a description of the range of acceptable keys; you need one subscript for each dimension of the array.

例如,在C/C ++中, a [10] [5] 是具有两个维度的数组:大小为10和大小为5.您需要两个下标或键来解决它的问题.元素.下标必须在0到9之间(含0和9);另一个下标在0到4之间.

For example, in C/C++ a[10][5] is an array with two dimensions: of size 10 and of size 5. You need two subscripts, or keys, to address its elements. One subscript has to be between 0 and 9, inclusive; the other subscript is between 0 and 4.

这篇关于我们所说的“尺寸"是什么意思?在谈论数组时?"的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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