Shift operators  Operator order of precedence

Chapter 1: Overview

Other operators

Operator

Description

Example

.

Structure member dereference.

mystruct.member

->

Pointer to structure member dereference.

mystruct->member

,

Comma operator.

In a list of expressions, causes use of the right-most expression.

The comma operator also strings together operations.

mydata = (1, 24, 94);

Results in mydata = 94;

for (a=0, b=5; a+b < = 50; a++, b++)

?

Conditional operator.

data = condition ? expr1: expr2;

where data = expr1 if condition is true, and data = expr2 if condition is false.

c = a > b ? 1: -1;

“c” = 1 if “a” is greater than “b”, and “c” = -1 if “a” is less than “b”.

sizeof

Computes the size, in bytes, of a datatype or variable.

sizeof (int)

sizeof (variable)

/* ... */

Multiple line comment indicator.

Everything between /* */ is commented out.

/* This is a comment that can display on multiple lines. */

//

Single line comment indicator.

Everything from the // to the end of the line is commented out of the code.

// This is a comment on one line.





Copyright © 2005. Sybase Inc. All rights reserved. Operator order of precedence

View this book as PDF