指针比较 [英] Pointer comparison

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

问题描述

不要在C和C ++的支持比较操作指针(> < 等)标准?

Do pointers in C and C++ support comparison operators (>, <, etc.) in standard?

我想比较阵列位置是precise。

I want to compare array positions to be precise.

推荐答案

在一个连续的阵列比较存储器偏移(指针)是确定。如果阵列作为一个链表(例如)实施的节点可能是遍布内存中,因此指针比较是没有意义的。

In a contiguous array comparing memory offsets (pointers) is OK. If your array is implemented as a linked list (for example) the nodes could be all over memory so pointer comparison is nonsensical.

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

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