不同的指针是否被认为是不同的数据类型? [英] Are different pointers considered to be different data types?

查看:60
本文介绍了不同的指针是否被认为是不同的数据类型?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为了更好地理解指针,我想澄清一下.不同的数据类型需要不同的指针,例如 char*int*.所有这些指针都被认为是不同的数据类型还是只是相同的数据类型?

In order to have better understanding of pointers, I'd like to have this cleared up. Different data types require different pointers, like char* or int*. Are all these pointers considered to be different data types or are they just the same data type?

推荐答案

是的,它们是不同的数据类型,因为它们指向不同类型的数据.

Yes, they are different data types, as they point to different types of data.

换句话说,它们的用法和属性各不相同(例如:不同指针类型上的相同指针运算会产生不同的结果)并且它们具有不同的对齐要求.

In other words, their usage and properties varies (example: same pointer arithmetic on different pointer type will yield different result) and they have different alignment requirements.

这篇关于不同的指针是否被认为是不同的数据类型?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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