Jump to content United States-English
HP.com Home Products and Services Support and Drivers Solutions How to Buy
» Contact HP
More options
HP.com home
HP C/HP-UX Reference Manual: Workstations and Servers > Chapter 5 Expressions

Address and Indirection Operators

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

The address (&) and indirection (*) operators are used to locate the address of an operand and indirectly access the contents of the address.

Syntax

& cast-expression
* cast-expression

Description

The operand of the unary indirection operator (*) must be a pointer to type T. The resulting type is T. If type T is not a function type, the unary-expression is an lvalue.

The contents of pointers are memory addresses. No range checking is done on indirection operations. Specifically, storing values indirectly through a pointer that was not correctly initialized can cause bounds errors or destruction of valid data.

The operand of the unary address-of operator (&) must be a function designator or an lvalue. This precludes taking the address of constants (for example, &3), because 3 is not an lvalue. If the type of the operand is T, the result of the address of operator is a pointer to type T. The & operator may not be applied to bit fields or objects with the register storage class.

It is always true that if E is an lvalue, then *&E is an lvalue expression equal to E.

Printable version
Privacy statement Using this site means you accept its terms Feedback to webmaster
© 1996 Hewlett-Packard Development Company, L.P.