当前位置:网站首页>[C language] void type and void* pointer type
[C language] void type and void* pointer type
2022-07-19 09:35:00 【An ran_】
List of articles
One 、void Role of type
1.C In language ,void It is an uncertain type , Cannot be used to declare variables . Such as void a=10; It's wrong. .
2. It is often used to limit the return type of a function . Such as void fun(int a);
3. It is often used to limit function parameters . Such as int fun(void);
Two 、void* The pointer
1. Definition :void* Is the pointer type with undetermined step size .
2. Generally used for function parameters 、 The return value of the function needs to be compatible with different pointer types .
3.void* Type variables can accept the assignment of pointers of any type , And there is no need to cast .void* Can be assigned to any type of variable , But you need to cast the result to make sense .
Such as
void* a=NULL;
int* b=NULL;
a=b;
int*a=NULL;
void *b=NULL;
a=(int*)b;
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-jPiO4rRW-1657963458696)(C:\Users\19271\AppData\Roaming\Typora\typora-user-images\image-20220708162451808.png)]](/img/e2/614feffc6395873f4e72211e49ae62.png)
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-R54dJHve-1657963458698)(C:\Users\19271\AppData\Roaming\Typora\typora-user-images\image-20220708162547678.png)]](/img/4c/3643d850bfcb57db93496ec9bba06e.png)
Although no error was reported , But such assignment is meaningless , It's not reasonable .
边栏推荐
猜你喜欢

【Flink】Flink 设置检查点失败一次就报错 setTolerableCheckpointFailureNumber 不起作用

在Pycharm里面如何避免全局索引?如何取消对于某个文件夹的索引?

Google play app store may delete the overview of APP permissions and use a new combination of data security information

第一部分—C语言基础篇_3. 运算符与表达式

Chapter 12 list of STL

Two structures ifconf and ifreq

el-table 列拖拽(无须引入其他插件)

KNN classifier

Makefile中在命令前加上- 则忽略该命令产生的错误,继续执行下一条命令

【洛谷】P2357 守墓人
随机推荐
C语言基础篇 —— 2-2 const关键字与指针
C——指针
Could NOT find CUDA (missing: CUDA_INCLUDE_DIRS) (found suitable exact version “11.4“)
cookie和session在实际项目中的使用
06---光在介质中的特性
[英雄星球七月集训LeetCode解题日报] 第17日 宽搜
Leetcode 197 Rising temperature (July 16, 2022)
pip和pip3的区别用法详解
C语言编译过程
Mux256to1v,Hadd,Fadd
【C语言】整形数据的存储
Microservice splitting for stand-alone projects
Es conceptual model and basic faults
Anycontrol demo demo demo
研究发现DNA纳米设备注射液可安全用于医疗用途
codeforces每日5题(均1500)-第十七天
un7.16:如何在码云上部署项目并邀请组员?
如何快速计算生成模型的FID、IS、sFID、Precision、Recall等关键评价指标?
LDA classifier
MySQL 视图
![[ Failed to transfer the external chain picture , The origin station may have anti-theft chain mechanism , It is suggested to save the pictures and upload them directly (img-367LIKlR-1657963458700)(C:\Users\19271\AppData\Roaming\Typora\typora-user-images\image-20220708162929493.png)]](/img/19/d24dc1bcbd2c26ee8bf75134b85df6.png)