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

Logical OR Operator

» 

Technical documentation

Complete book in PDF
» Feedback
Content starts here

 » Table of Contents

 » Index

The logical OR operator (||) performs the logical OR function on its operands.

Syntax

logical-OR-expression ::=
logical-AND-expression
logical-OR-expression || logical-AND-expression

Description

Each of the operands must be of scalar type. The type of the left operand need not be related to the type of the right operand. The result has type int and has a value of 1 if either of its operands compare unequal to 0, and 0 otherwise. The result is not an lvalue.

The logical OR operator guarantees left-to-right evaluation. If the first operand compares unequal to 0, the second operand is not evaluated.

Example

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