C/C++ 中的指针

指针(pointer)有两种涵义

一是指C/C++中的一种数据类型(data type)。

二是指某个类型为指针的 数据/物件(object)。

指针作为一种数据类型,属所谓复合类型(compound types)。

若非特别指明,下文中所言的指针皆为第二种涵义。

A compound type is a type that is defined in terms of another type. A pointer is a compound type that "points to" another type. Pointers are used for indirect access of other objects. A pointer is an object in its own right. A pointer holds the address of another object.

 

Pointer Values

The value (i.e., the address) stored in a pointer can be in one of four states:

1. It can point to an object

2. It can point to the location just immediately past the end of an object

3. It can be a null pointer, indicating that it is not bound to any object

4. It can be invalid; values other than the preceeding three are invalid

 

posted @ 2015-08-17 13:50  Pat  阅读(235)  评论(0编辑  收藏  举报