用C语言定义一维二维数组 [英] Defining a 1-D array of 2-D Arrays in C

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

问题描述

Hello Friends,


我想声明一个1-D数组,它将元素作为2-D整数数组包含在C.这里,我要访问整个二维阵列。

我也尝试搜索文本和网络,但找不到/理解一些重要的东西。


有人可以帮忙吗。??


谢谢

--M Singh

Hello Friends,

I want to declare a 1-D array which will contain its elements as a 2-D array of integers, in C. Here, I want to access the 2-D arrays as a whole.
I tried searching the texts and the net too, but could not find/understand something significant.

Can someone help please.??

Thanks
--M Singh

推荐答案

我建​​议你先阅读显示的数组

如果您有其他具体问题,请告诉我们。
I suggest you start by reading Arrays Revealed.
Let us know if you have specific further questions.


@donbock

感谢您的回复。但是,这还没有解决我的问题。

实际上,我想要的东西如下: -

我必须存储2-D数组,如: - [1 2 3; 4 5 6; 7 8 9] [2 3 4; 5 6 7; 8 9 10] ....等等(比如说10个阵列)。现在我想将这些数组存储在另一个数组中,如[[....] [...] [...] [...] ... [...]]。

所以,我可以在C中执行此操作,如果是,那么如何声明数组数组。


请帮忙。


谢谢

--- M Singh
@donbock
Thanks for the response. However, this has not solved my problem.
Actually, I want something as following:-

I have to store 2-D arrays like:- [1 2 3; 4 5 6; 7 8 9] [2 3 4; 5 6 7; 8 9 10].... and so on (say 10 arrays lke this) . Now I want to store these arrays in another array like [ [....] [...] [...] [...] ...[...] ].

So, can I do this in C, if yes, then how do I declare the array of arrays.

Please help.

Thanks
---M Singh


@ msingh00


这将是一个三维数组:int array [10] [3] [3];

@ msingh00


这将是一个四维数组:int array [6] [10] [3] [3];

(例如,如果,你想将六个这些数组存储在另一个数组中。)


顺便说一句,你的第一个例子的正确初始化程序将是
@msingh00
That would be a three-dimensional array: int array[10][3][3];

@msingh00
That would be a four-dimensional array: int array[6][10][3][3];
(if, for example, you wanted to store six of "these arrays in another array".)

By the way, the correct initializer for your first example would be
展开 | 选择 | < span class =codeLinkonclick =WordWrap(this);> Wrap | 行号


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

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