Declaring Pointers

The following example declares pcoat as a pointer to an object having type long:

      long *pcoat;

If the keyword volatile appears before the *, the declarator describes a pointer to a volatile object. If the keyword volatile appears between the * and the identifier, the declarator describes a volatile pointer. The keyword const operates in the same manner as the volatile keyword. In the following example, pvolt is a constant pointer to an object having type short:

      extern short * const pvolt;

The following example declares pnut as a pointer to an int object having the volatile qualifier:

      extern int volatile *pnut;

The following example defines psoup as a volatile pointer to an object having type float:

      float * volatile psoup;

The following example defines pfowl as a pointer to an enumeration object of type bird:

      enum bird *pfowl;

The next example declares pvish as a pointer to a function that takes no parameters and returns a char object:

      char (*pvish)(void);

Related References

IBM Copyright 2003