创建数据类型数组 [英] Creating array of data types

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

问题描述

大家好,


我希望你能帮助我创建一系列数据类型。


我有兴趣看看看起来像这样的数据类型

数组a [10] = {int,float,char,int * ................... ..........},


所以a [0]应该返回int并且[1]应该返回我

float..which帮助我进行运行时类型转换。


我不知道如何创建这样的数组。如果我创建那么

将是数组的数据类型。

这基本上是数据类型的变量。转换。


或者有更好的方法来做到这一点。


热切期待回应..

问候,

Madhur

Hi All,

I would like you help me in creating an array of data types.

I am interested in look at the the data type which looks like this
Array a[10]={int,float,char,int*............................. .},

so that a[0] should return me int and a[1] should return me
float..which helps me in runtime type casting.

I do not know how to create such an array. If i create so what would
be the data type of "Array".
This is basically a variable to "data type" conversion.

Or is there any better way to do this.

Looking keenly for the response..

Regards,
Madhur

推荐答案

Madhur写道:
Madhur wrote:

大家好,


我希望你帮我创建一个数组类型。
Hi All,

I would like you help me in creating an array of data types.



我不认为我能做到这一点......

I don''t think I can do that...


我对看起来感兴趣在看起来像这样的数据类型


数组a [10] = {int,float,char,int * .............. ................},
I am interested in look at the the data type which looks like this
Array a[10]={int,float,char,int*............................. .},



****的含义是什么意思?

What the **** does that mean?


所以a [0]应该返回int并且[1]应该返回我

float..which帮助我进行运行时类型转换。
so that a[0] should return me int and a[1] should return me
float..which helps me in runtime type casting.



您可以对联合做一些事情,但数组的想法是元素基本等价的
。如果你知道[0]是一个

int,[1]一个浮点数等,那么它们应该只是个别变量,

我已经想到了。

You could possibly do something with unions, but the idea of arrays is
that elements are essentially equivalent. If you know that a[0] is an
int, a[1] a float, etc then they should simply be individual variables,
I''d have thought.


>

我不知道如何创建这样的数组。如果我创建那么

将是数组的数据类型。

这基本上是数据类型的变量。转换。


或者有更好的方法来做到这一点。
>
I do not know how to create such an array. If i create so what would
be the data type of "Array".
This is basically a variable to "data type" conversion.

Or is there any better way to do this.



我想你应该告诉我们你想用更广泛的

条款 - 你的原始要求 - 而不是告诉我们你是怎么做的试图做到这一点


I think you should tell us what you are trying to achieve in broader
terms - your original requirement - rather than telling us how you are
trying to do it.


Mark Bluemel说:


< snip>
Mark Bluemel said:

<snip>

****的含义是什么意思?
What the **** does that mean?



在声明上下文中,它表示指向指向

指针的指针指向指向类型对象的指针。 br />

在表达式上下文中,它可能意味着将乘以 br />
的确如此,或者它只是意味着指向值指向的值

由指向的值指向的值。


本文是由巧合的

Justified Usenet文章协会提供给您的。令人高兴的是,巧合延伸到了描述它的段落。


-

Richard Heathfield< http: //www.cpax.org.uk>

电子邮件:-www。 + rjh @

谷歌用户:< http://www.cpax.org.uk/prg/writings/googly.php>

Usenet是一个奇怪的放置" - dmr 1999年7月29日

In a declaration context, it means that does is a pointer to pointer to
pointer to pointer to an object of type the.

In an expression context, it could mean that the is to be multiplied by
the value pointed to by the value pointed to by the value pointed to by
does, or it could simply mean the value pointed to by the value pointed
to by the value pointed to by the value pointed to by does.

This article was brought to you by courtesy of the Coincidentally Right
Justified Usenet Articles Association. Happily, the coincidence extends
even to the very paragraph that describes it.

--
Richard Heathfield <http://www.cpax.org.uk>
Email: -www. +rjh@
Google users: <http://www.cpax.org.uk/prg/writings/googly.php>
"Usenet is a strange place" - dmr 29 July 1999


感谢您的信息...


上面提到的数组列出了数百个用户定义的数据类型

我每次都不可能照顾它,除非我有一个明确的哈希维护它,我无法正常娱乐

现在..因此我一直在寻找数据类型的数组......似乎

是不可能的......


是枚举是唯一的方式去..但是有没有我可以如何链接

枚举数据类型的索引...说enum看起来像这样


typedef union enum1

{

type0,

type1,

type2,

type3 < br $> b $ b ..

..

..

类型n

} ENUM1;


所以如果得到一个索引说2我可以在不使用type2的情况下提取type2

表达...

更好的方式..在某种程度上ican提到ENUM(2),它应该

得到我type2 ????


7月24日下午1点34分,Mark Bluemel< mark_blue ... @ pobox.comwrote:
Thanks for the info...

Array as referred above is list hundreds of user defined data types
and it is impossible for me to take care of it each time unless i have
an explicit hash maintained to it which i can not entertain right
now.. therefore I was looking for array of data types..which seems to
be impossible...

Yes Enumeration is the only way to go..but is there any how i can link
an index to the enum data type...say enum looks like this

typedef union enum1
{
type0,
type1,
type2,
type3
..
..
..
type n
}ENUM1;

so if get an index say 2 can i extract type2 without using type2
explicity..
in better way..is there somehow ican mention ENUM(2) and which should
get me type2????


On Jul 24, 1:34 pm, Mark Bluemel <mark_blue...@pobox.comwrote:

Madhur写道:
Madhur wrote:

大家好,
Hi All,


我想帮助我创建一个数据类型数组。
I would like you help me in creating an array of data types.



我不认为我能做到这一点......


I don''t think I can do that...


我对看起来感兴趣在数据类型看起来像这样
I am interested in look at the the data type which looks like this


数组a [10] = {int,float,char,int * ...... ........................},
Array a[10]={int,float,char,int*............................. .},



****做了什么意思是?


What the **** does that mean?


所以a [0]应该返回我int并且[1]应该返回我

float..which帮助我在运行时类型转换中。
so that a[0] should return me int and a[1] should return me
float..which helps me in runtime type casting.



您可以对联合做一些事情,但数组的想法是元素基本等价的
。如果你知道[0]是一个

int,[1]一个浮点数等,那么它们应该只是个别变量,

我已经想到了。


You could possibly do something with unions, but the idea of arrays is
that elements are essentially equivalent. If you know that a[0] is an
int, a[1] a float, etc then they should simply be individual variables,
I''d have thought.


我不知道如何创建这样的数组。如果我创建那么

将是数组的数据类型。

这基本上是数据类型的变量。转换。
I do not know how to create such an array. If i create so what would
be the data type of "Array".
This is basically a variable to "data type" conversion.


或者有更好的方法可以做到这一点。
Or is there any better way to do this.



我想你应该告诉我们你想用更广泛的

条款 - 你原来的要求 - 而不是告诉我们你是怎么做的

试图这样做。


I think you should tell us what you are trying to achieve in broader
terms - your original requirement - rather than telling us how you are
trying to do it.



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

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