我们如何发送多维数组的元素? [英] How are we send the element of multi-dimensional array?

查看:58
本文介绍了我们如何发送多维数组的元素?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

你好朋友,



有谁能告诉我,我们如何发送多维阵列的特定元素?



我的条件如下:

我有一个二维数组

Hello Friends,

Can anybody tell me that how are we send the particular element of multi-dimensional array?

My condition is as below:
I have a two dimensional array

m_pJGraphicSurface[2][4];



此数组的所有元素都填充了值。现在我想一次发送第一行的前四个元素然后接下来四个意味着


All element of this array is filled with values. Now I want to send the first four element of first row at a time and then next four means

m_pJGraphicSurface[i][All_Four_Element].



我们如何在vc ++中执行此操作?

请帮我解决此问题。

谢谢


How can we do this in vc++?
Please help me to resolve this.
Thanks

推荐答案

理查德是对的。这是不寻常的,但你可以做到。



Richard is right. It's a it unusual but you can do it.

JGSurface m_pJGraphicSurface[2][4];

JGSurface* pFirstRow = m_pJGraphicSurface[0];
JGSurface* pSecondRow = m_pJGraphicSurface[1];







这是不寻常的,因为如果我们只有两个东西,这是一个常数,然后他们经常只给两个单独的变量名称,如FirstRow和SecondRow,而不是在一个数组中绑定在一起,除非由于其他原因需要。即使内存需要一起完成,也可以用 struct 来实现,例如






It's unusual because if we only have 2 of something and that is a constant then they are very often just given two separate variable names, like FirstRow and SecondRow rather than being tied together in one array unless that's needed for other reasons. Even if the memory needs to be all together that can be achieved with a struct e.g.

struct GraphicSurfaces
{
  JGSurface FirstRow[4];
  JGSurface SecondRow[4];
};





这是风格问题,当然还有你需要实现的目标。



It's a matter of style and of course what you need to achieve.

我做了一件事。发送每行中元素的行和计数。在被调用函数中创建一个循环并获取发送行的每个元素。现在做我想做的事情并将其存储在相同的数量上。
I do one thing. Send the row and the count of the element in each row.Make one loop in called function and get each element of the sent row. Now do what ever I want and store it on same count.


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

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