是无效在C数据类型? [英] Is void a data type in C?

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

问题描述

我可以知道,如果是无效数据类型C?什么类型的值可以保存,如果我们有整型,浮点,字符等,以存储值为什么是无效的需要?

Can I know if void is data type in "C"? what type of values it can store, if we have int, float, char etc to store the values why is void needed?

推荐答案

虚空被认为是一种数据类型(组织的目的),但它基本上是作为一个占位符来使用,你会放一个数据类型的关键字,再present无数据。

Void is considered a data type (for organizational purposes), but it is basically a keyword to use as a placeholder where you would put a data type, to represent "no data".

因此​​,你可以声明常规不返回一个值:

Hence, you can declare a routine which does not return a value as:

void MyRoutine();

但是,你不能声明一个变量:

But, you cannot declare a variable like this:

void bad_variable;

然而,作为一个指针使用时,那么它具有不同的含义:

However, when used as a pointer, then it has a different meaning:

void* vague_pointer;

这声明的指针,但没有指明它指向的数据类型。

This declares a pointer, but without specifying which data type it is pointing to.

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

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