空指针和空指针有什么区别? [英] What's the difference between a null pointer and a void pointer?

查看:29
本文介绍了空指针和空指针有什么区别?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

空指针空指针有什么区别?空指针?

推荐答案

Null pointer 是指针的特殊保留.任何类型的指针都有这样的保留值.形式上,每个特定的指针类型(int *char * 等)都有自己专用的空指针值.从概念上讲,当指针具有空值时,它不会指向任何地方.

Null pointer is a special reserved value of a pointer. A pointer of any type has such a reserved value. Formally, each specific pointer type (int *, char * etc.) has its own dedicated null-pointer value. Conceptually, when a pointer has that null value it is not pointing anywhere.

Void pointer 是一个特定的指针 type - void * - 一个指向存储中某个数据位置的指针,它不会有任何特定类型.

Void pointer is a specific pointer type - void * - a pointer that points to some data location in storage, which doesn't have any specific type.

所以,再一次,空指针是一个,而空指针是一个类型.这些概念完全不同,没有可比性.这基本上意味着您的问题,如上所述,并不完全有效.这就像问,例如,三角形和汽车有什么区别?".

So, once again, null pointer is a value, while void pointer is a type. These concepts are totally different and non-comparable. That essentially means that your question, as stated, is not exactly valid. It is like asking, for example, "What is the difference between a triangle and a car?".

这篇关于空指针和空指针有什么区别?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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