关于VOID的问题 [英] Question on VOID

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

问题描述

大家好,


我想知道无效吗?


C编程语言属于哪个类别?

有多少位无效?


是否可以定义一个名为
的变量
void a;


感谢大家的评论!


Zeh

解决方案

Zero写道:


>

大家好,


我想知道无效吗? br />

C编程语言属于哪个类别?



(void)是一个不完整类型。


有多少比特无效?


是否可以定义一个名为

void a的变量;



No.


-

pete


10月16日上午6:54,Zero< chefmue ... @ web.dewrote:


Hello all,


我想知道无效吗?


C编程语言属于哪个类别?

有多少比特需要无效?


是否可以定义一个名为
的varibale
void a;


谢谢大家的支持评论!


Zeh



零,


1.无效 ;是C中的数据类型。

2." void"通常与处理器的
体系结构的位数相同。

- 因此在8位微虚空中将是8位。您需要在编译器中对此进行验证。

3.您无法将变量定义为void a;但你可以将

指针定义为void * a;。

- Void指针用于将无类型数据传入和传出

函数。

- Void指针也可用于将指针传递给其他

函数(即函数指针)。


这是一个可以进一步解释的链接。

http://tigcc.ticalc.org/doc/keywords.html#void


希望这会有所帮助,


Keith
http://www.doubleblackdesign.com


husterk写道:

....


2."空隙"通常与处理器的
体系结构的位数相同。

- 因此在8位微虚空中将是8位。您需要在编译器中对此进行验证。



" void"是一种无法完成的不完整类型;它没有

大小。


你可能会想到一些编译器鼓励人们的事实

到通过允许对void *

指针进行指针运算来编写有缺陷的代码,在这种情况下,它被视为与char *基本相同。

因此,有效的位大小为CHAR_BITS 。但是,如果你要引用那个功能,你应该警告它是

特定于实现。


Hello all,

I wonder about void?

To which category in the C programming language does it belong?
Of how many bits consits void?

Is it possible to define a varibale called
void a;

Thank you all for your comments!

Zeh

解决方案

Zero wrote:

>
Hello all,

I wonder about void?

To which category in the C programming language does it belong?

(void) is an "incomplete type".

Of how many bits consits void?

Is it possible to define a varibale called
void a;

No.

--
pete


On Oct 16, 6:54 am, Zero <chefmue...@web.dewrote:

Hello all,

I wonder about void?

To which category in the C programming language does it belong?
Of how many bits consits void?

Is it possible to define a varibale called
void a;

Thank you all for your comments!

Zeh

Zero,

1. "void" is a datatype in C.
2. "void" is typically the same number of bits as your processor''s
architecture.
- So in an 8-bit micro void would be 8-bits. You will need to
verify this in your compiler though.
3. You cannot define a variable as "void a;" but you can define a
pointer as "void *a;".
- Void pointers are used to pass typeless data into and out of
functions.
- Void pointers can also be use to pass pointers to other
functions (i.e. function pointers).

Here is a link that explains this further.

http://tigcc.ticalc.org/doc/keywords.html#void

Hope this helps,

Keith
http://www.doubleblackdesign.com


husterk wrote:
....

2. "void" is typically the same number of bits as your processor''s
architecture.
- So in an 8-bit micro void would be 8-bits. You will need to
verify this in your compiler though.

"void" is an incomplete type that cannot be completed; it doesn''t have a
size.

You may be thinking about the fact that some compilers encourage people
to write defective code by allowing pointer arithmetic on void*
pointers, in which context it is treated essentially the same as char*.
Thus, the effective size in bits is CHAR_BITS. However, if you''re going
to refer to that "feature", you should warn that it is
implementation-specific.


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

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